home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / cc / calls.c < prev    next >
C/C++ Source or Header  |  1993-12-13  |  98KB  |  3,032 lines

  1. /* Convert function calls to rtl insns, for GNU C compiler.
  2.    Copyright (C) 1989, 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include "config.h"
  21. #include "rtl.h"
  22. #include "tree.h"
  23. #include "flags.h"
  24. #include "expr.h"
  25. #include "gvarargs.h"
  26. #include "insn-flags.h"
  27.  
  28. /* Decide whether a function's arguments should be processed
  29.    from first to last or from last to first.
  30.  
  31.    They should if the stack and args grow in opposite directions, but
  32.    only if we have push insns.  */
  33.  
  34. #ifdef PUSH_ROUNDING
  35.  
  36. #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
  37. #define PUSH_ARGS_REVERSED    /* If it's last to first */
  38. #endif
  39.  
  40. #endif
  41.  
  42. /* Like STACK_BOUNDARY but in units of bytes, not bits.  */
  43. #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
  44.  
  45. /* Data structure and subroutines used within expand_call.  */
  46.  
  47. struct arg_data
  48. {
  49.   /* Tree node for this argument.  */
  50.   tree tree_value;
  51.   /* Mode for value; TYPE_MODE unless promoted.  */
  52.   enum machine_mode mode;
  53.   /* Current RTL value for argument, or 0 if it isn't precomputed.  */
  54.   rtx value;
  55.   /* Initially-compute RTL value for argument; only for const functions.  */
  56.   rtx initial_value;
  57.   /* Register to pass this argument in, 0 if passed on stack, or an
  58.      EXPR_LIST if the arg is to be copied into multiple different
  59.      registers.  */
  60.   rtx reg;
  61.   /* If REG was promoted from the actual mode of the argument expression,
  62.      indicates whether the promotion is sign- or zero-extended.  */
  63.   int unsignedp;
  64.   /* Number of registers to use.  0 means put the whole arg in registers.
  65.      Also 0 if not passed in registers.  */
  66.   int partial;
  67.   /* Non-zero if argument must be passed on stack.
  68.      Note that some arguments may be passed on the stack
  69.      even though pass_on_stack is zero, just because FUNCTION_ARG says so.
  70.      pass_on_stack identifies arguments that *cannot* go in registers.  */
  71.   int pass_on_stack;
  72.   /* Offset of this argument from beginning of stack-args.  */
  73.   struct args_size offset;
  74.   /* Similar, but offset to the start of the stack slot.  Different from
  75.      OFFSET if this arg pads downward.  */
  76.   struct args_size slot_offset;
  77.   /* Size of this argument on the stack, rounded up for any padding it gets,
  78.      parts of the argument passed in registers do not count.
  79.      If REG_PARM_STACK_SPACE is defined, then register parms
  80.      are counted here as well.  */
  81.   struct args_size size;
  82.   /* Location on the stack at which parameter should be stored.  The store
  83.      has already been done if STACK == VALUE.  */
  84.   rtx stack;
  85.   /* Location on the stack of the start of this argument slot.  This can
  86.      differ from STACK if this arg pads downward.  This location is known
  87.      to be aligned to FUNCTION_ARG_BOUNDARY.  */
  88.   rtx stack_slot;
  89. #ifdef ACCUMULATE_OUTGOING_ARGS
  90.   /* Place that this stack area has been saved, if needed.  */
  91.   rtx save_area;
  92. #endif
  93. #ifdef STRICT_ALIGNMENT
  94.   /* If an argument's alignment does not permit direct copying into registers,
  95.      copy in smaller-sized pieces into pseudos.  These are stored in a
  96.      block pointed to by this field.  The next field says how many
  97.      word-sized pseudos we made.  */
  98.   rtx *aligned_regs;
  99.   int n_aligned_regs;
  100. #endif
  101. };
  102.  
  103. #ifdef ACCUMULATE_OUTGOING_ARGS
  104. /* A vector of one char per byte of stack space.  A byte if non-zero if
  105.    the corresponding stack location has been used.
  106.    This vector is used to prevent a function call within an argument from
  107.    clobbering any stack already set up.  */
  108. static char *stack_usage_map;
  109.  
  110. /* Size of STACK_USAGE_MAP.  */
  111. static int highest_outgoing_arg_in_use;
  112.  
  113. /* stack_arg_under_construction is nonzero when an argument may be
  114.    initialized with a constructor call (including a C function that
  115.    returns a BLKmode struct) and expand_call must take special action
  116.    to make sure the object being constructed does not overlap the
  117.    argument list for the constructor call.  */
  118. int stack_arg_under_construction;
  119. #endif
  120.  
  121. static int calls_function    PROTO((tree, int));
  122. static int calls_function_1    PROTO((tree, int));
  123. static void emit_call_1        PROTO((rtx, tree, int, int, rtx, rtx, int,
  124.                        rtx, int));
  125. static void store_one_arg    PROTO ((struct arg_data *, rtx, int, int,
  126.                     tree, int));
  127.  
  128. /* If WHICH is 1, return 1 if EXP contains a call to the built-in function
  129.    `alloca'.
  130.  
  131.    If WHICH is 0, return 1 if EXP contains a call to any function.
  132.    Actually, we only need return 1 if evaluating EXP would require pushing
  133.    arguments on the stack, but that is too difficult to compute, so we just
  134.    assume any function call might require the stack.  */
  135.  
  136. static tree calls_function_save_exprs;
  137.  
  138. static int
  139. calls_function (exp, which)
  140.      tree exp;
  141.      int which;
  142. {
  143.   int val;
  144.   calls_function_save_exprs = 0;
  145.   val = calls_function_1 (exp, which);
  146.   calls_function_save_exprs = 0;
  147.   return val;
  148. }
  149.  
  150. static int
  151. calls_function_1 (exp, which)
  152.      tree exp;
  153.      int which;
  154. {
  155.   register int i;
  156.   int type = TREE_CODE_CLASS (TREE_CODE (exp));
  157.   int length = tree_code_length[(int) TREE_CODE (exp)];
  158.  
  159.   /* Only expressions and references can contain calls.  */
  160.  
  161.   if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r'
  162.       && type != 'b')
  163.     return 0;
  164.  
  165.   switch (TREE_CODE (exp))
  166.     {
  167.     case CALL_EXPR:
  168.       if (which == 0)
  169.     return 1;
  170.       else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
  171.            && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  172.            == FUNCTION_DECL)
  173.            && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  174.            && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  175.            == BUILT_IN_ALLOCA))
  176.     return 1;
  177.  
  178.       /* Third operand is RTL.  */
  179.       length = 2;
  180.       break;
  181.  
  182.     case SAVE_EXPR:
  183.       if (SAVE_EXPR_RTL (exp) != 0)
  184.     return 0;
  185.       if (value_member (exp, calls_function_save_exprs))
  186.     return 0;
  187.       calls_function_save_exprs = tree_cons (NULL_TREE, exp,
  188.                          calls_function_save_exprs);
  189.       return (TREE_OPERAND (exp, 0) != 0
  190.           && calls_function_1 (TREE_OPERAND (exp, 0), which));
  191.  
  192.     case BLOCK:
  193.       {
  194.     register tree local;
  195.  
  196.     for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local))
  197.       if (DECL_INITIAL (local) != 0
  198.           && calls_function_1 (DECL_INITIAL (local), which))
  199.         return 1;
  200.       }
  201.       {
  202.     register tree subblock;
  203.  
  204.     for (subblock = BLOCK_SUBBLOCKS (exp);
  205.          subblock;
  206.          subblock = TREE_CHAIN (subblock))
  207.       if (calls_function_1 (subblock, which))
  208.         return 1;
  209.       }
  210.       return 0;
  211.  
  212.     case METHOD_CALL_EXPR:
  213.       length = 3;
  214.       break;
  215.  
  216.     case WITH_CLEANUP_EXPR:
  217.       length = 1;
  218.       break;
  219.  
  220.     case RTL_EXPR:
  221.       return 0;
  222.     }
  223.  
  224.   for (i = 0; i < length; i++)
  225.     if (TREE_OPERAND (exp, i) != 0
  226.     && calls_function_1 (TREE_OPERAND (exp, i), which))
  227.       return 1;
  228.  
  229.   return 0;
  230. }
  231.  
  232. /* Force FUNEXP into a form suitable for the address of a CALL,
  233.    and return that as an rtx.  Also load the static chain register
  234.    if FNDECL is a nested function.
  235.  
  236.    USE_INSNS points to a variable holding a chain of USE insns
  237.    to which a USE of the static chain
  238.    register should be added, if required.  */
  239.  
  240. rtx
  241. prepare_call_address (funexp, fndecl, use_insns)
  242.      rtx funexp;
  243.      tree fndecl;
  244.      rtx *use_insns;
  245. {
  246.   rtx static_chain_value = 0;
  247.  
  248.   funexp = protect_from_queue (funexp, 0);
  249.  
  250.   if (fndecl != 0)
  251.     /* Get possible static chain value for nested function in C. */
  252.     static_chain_value = lookup_static_chain (fndecl);
  253.  
  254.   /* Make a valid memory address and copy constants thru pseudo-regs,
  255.      but not for a constant address if -fno-function-cse.  */
  256.   if (GET_CODE (funexp) != SYMBOL_REF)
  257.     funexp = memory_address (FUNCTION_MODE, funexp);
  258.   else
  259.     {
  260. #ifndef NO_FUNCTION_CSE
  261.       if (optimize && ! flag_no_function_cse)
  262. #ifdef NO_RECURSIVE_FUNCTION_CSE
  263.     if (fndecl != current_function_decl)
  264. #endif
  265.       funexp = force_reg (Pmode, funexp);
  266. #endif
  267.     }
  268.  
  269.   if (static_chain_value != 0)
  270.     {
  271.       emit_move_insn (static_chain_rtx, static_chain_value);
  272.  
  273.       /* Put the USE insn in the chain we were passed.  It will later be
  274.      output immediately in front of the CALL insn.  */
  275.       push_to_sequence (*use_insns);
  276.       emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
  277.       *use_insns = get_insns ();
  278.       end_sequence ();
  279.     }
  280.  
  281.   return funexp;
  282. }
  283.  
  284. /* Generate instructions to call function FUNEXP,
  285.    and optionally pop the results.
  286.    The CALL_INSN is the first insn generated.
  287.  
  288.    FUNTYPE is the data type of the function, or, for a library call,
  289.    the identifier for the name of the call.  This is given to the
  290.    macro RETURN_POPS_ARGS to determine whether this function pops its own args.
  291.  
  292.    STACK_SIZE is the number of bytes of arguments on the stack,
  293.    rounded up to STACK_BOUNDARY; zero if the size is variable.
  294.    This is both to put into the call insn and
  295.    to generate explicit popping code if necessary.
  296.  
  297.    STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value.
  298.    It is zero if this call doesn't want a structure value.
  299.  
  300.    NEXT_ARG_REG is the rtx that results from executing
  301.      FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
  302.    just after all the args have had their registers assigned.
  303.    This could be whatever you like, but normally it is the first
  304.    arg-register beyond those used for args in this call,
  305.    or 0 if all the arg-registers are used in this call.
  306.    It is passed on to `gen_call' so you can put this info in the call insn.
  307.  
  308.    VALREG is a hard register in which a value is returned,
  309.    or 0 if the call does not return a value.
  310.  
  311.    OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before
  312.    the args to this call were processed.
  313.    We restore `inhibit_defer_pop' to that value.
  314.  
  315.    USE_INSNS is a chain of USE insns to be emitted immediately before
  316.    the actual CALL insn.
  317.  
  318.    IS_CONST is true if this is a `const' call.  */
  319.  
  320. static void
  321. emit_call_1 (funexp, funtype, stack_size, struct_value_size, next_arg_reg,
  322.          valreg, old_inhibit_defer_pop, use_insns, is_const)
  323.      rtx funexp;
  324.      tree funtype;
  325.      int stack_size;
  326.      int struct_value_size;
  327.      rtx next_arg_reg;
  328.      rtx valreg;
  329.      int old_inhibit_defer_pop;
  330.      rtx use_insns;
  331.      int is_const;
  332. {
  333.   rtx stack_size_rtx = GEN_INT (stack_size);
  334.   rtx struct_value_size_rtx = GEN_INT (struct_value_size);
  335.   rtx call_insn;
  336.   int already_popped = 0;
  337.  
  338.   /* Ensure address is valid.  SYMBOL_REF is already valid, so no need,
  339.      and we don't want to load it into a register as an optimization,
  340.      because prepare_call_address already did it if it should be done.  */
  341.   if (GET_CODE (funexp) != SYMBOL_REF)
  342.     funexp = memory_address (FUNCTION_MODE, funexp);
  343.  
  344. #ifndef ACCUMULATE_OUTGOING_ARGS
  345. #if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
  346.   if (HAVE_call_pop && HAVE_call_value_pop
  347.       && (RETURN_POPS_ARGS (funtype, stack_size) > 0 || stack_size == 0))
  348.     {
  349.       rtx n_pop = GEN_INT (RETURN_POPS_ARGS (funtype, stack_size));
  350.       rtx pat;
  351.  
  352.       /* If this subroutine pops its own args, record that in the call insn
  353.      if possible, for the sake of frame pointer elimination.  */
  354.       if (valreg)
  355.     pat = gen_call_value_pop (valreg,
  356.                   gen_rtx (MEM, FUNCTION_MODE, funexp),
  357.                   stack_size_rtx, next_arg_reg, n_pop);
  358.       else
  359.     pat = gen_call_pop (gen_rtx (MEM, FUNCTION_MODE, funexp),
  360.                 stack_size_rtx, next_arg_reg, n_pop);
  361.  
  362.       emit_call_insn (pat);
  363.       already_popped = 1;
  364.     }
  365.   else
  366. #endif
  367. #endif
  368.  
  369. #if defined (HAVE_call) && defined (HAVE_call_value)
  370.   if (HAVE_call && HAVE_call_value)
  371.     {
  372.       if (valreg)
  373.     emit_call_insn (gen_call_value (valreg,
  374.                     gen_rtx (MEM, FUNCTION_MODE, funexp),
  375.                     stack_size_rtx, next_arg_reg,
  376.                     NULL_RTX));
  377.       else
  378.     emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, funexp),
  379.                   stack_size_rtx, next_arg_reg,
  380.                   struct_value_size_rtx));
  381.     }
  382.   else
  383. #endif
  384.     abort ();
  385.  
  386.   /* Find the CALL insn we just emitted and write the USE insns before it.  */
  387.   for (call_insn = get_last_insn ();
  388.        call_insn && GET_CODE (call_insn) != CALL_INSN;
  389.        call_insn = PREV_INSN (call_insn))
  390.     ;
  391.  
  392.   if (! call_insn)
  393.     abort ();
  394.  
  395.   /* Put the USE insns before the CALL.  */
  396.   emit_insns_before (use_insns, call_insn);
  397.  
  398.   /* If this is a const call, then set the insn's unchanging bit.  */
  399.   if (is_const)
  400.     CONST_CALL_P (call_insn) = 1;
  401.  
  402.   /* Restore this now, so that we do defer pops for this call's args
  403.      if the context of the call as a whole permits.  */
  404.   inhibit_defer_pop = old_inhibit_defer_pop;
  405.  
  406. #ifndef ACCUMULATE_OUTGOING_ARGS
  407.   /* If returning from the subroutine does not automatically pop the args,
  408.      we need an instruction to pop them sooner or later.
  409.      Perhaps do it now; perhaps just record how much space to pop later.
  410.  
  411.      If returning from the subroutine does pop the args, indicate that the
  412.      stack pointer will be changed.  */
  413.  
  414.   if (stack_size != 0 && RETURN_POPS_ARGS (funtype, stack_size) > 0)
  415.     {
  416.       if (!already_popped)
  417.     emit_insn (gen_rtx (CLOBBER, VOIDmode, stack_pointer_rtx));
  418.       stack_size -= RETURN_POPS_ARGS (funtype, stack_size);
  419.       stack_size_rtx = GEN_INT (stack_size);
  420.     }
  421.  
  422.   if (stack_size != 0)
  423.     {
  424.       if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const)
  425.     pending_stack_adjust += stack_size;
  426.       else
  427.     adjust_stack (stack_size_rtx);
  428.     }
  429. #endif
  430. }
  431.  
  432. /* Generate all the code for a function call
  433.    and return an rtx for its value.
  434.    Store the value in TARGET (specified as an rtx) if convenient.
  435.    If the value is stored in TARGET then TARGET is returned.
  436.    If IGNORE is nonzero, then we ignore the value of the function call.  */
  437.  
  438. rtx
  439. expand_call (exp, target, ignore)
  440.      tree exp;
  441.      rtx target;
  442.      int ignore;
  443. {
  444.   /* List of actual parameters.  */
  445.   tree actparms = TREE_OPERAND (exp, 1);
  446.   /* RTX for the function to be called.  */
  447.   rtx funexp;
  448.   /* Tree node for the function to be called (not the address!).  */
  449.   tree funtree;
  450.   /* Data type of the function.  */
  451.   tree funtype;
  452.   /* Declaration of the function being called,
  453.      or 0 if the function is computed (not known by name).  */
  454.   tree fndecl = 0;
  455.   char *name = 0;
  456.  
  457.   /* Register in which non-BLKmode value will be returned,
  458.      or 0 if no value or if value is BLKmode.  */
  459.   rtx valreg;
  460.   /* Address where we should return a BLKmode value;
  461.      0 if value not BLKmode.  */
  462.   rtx structure_value_addr = 0;
  463.   /* Nonzero if that address is being passed by treating it as
  464.      an extra, implicit first parameter.  Otherwise,
  465.      it is passed by being copied directly into struct_value_rtx.  */
  466.   int structure_value_addr_parm = 0;
  467.   /* Size of aggregate value wanted, or zero if none wanted
  468.      or if we are using the non-reentrant PCC calling convention
  469.      or expecting the value in registers.  */
  470.   int struct_value_size = 0;
  471.   /* Nonzero if called function returns an aggregate in memory PCC style,
  472.      by returning the address of where to find it.  */
  473.   int pcc_struct_value = 0;
  474.  
  475.   /* Number of actual parameters in this call, including struct value addr.  */
  476.   int num_actuals;
  477.   /* Number of named args.  Args after this are anonymous ones
  478.      and they must all go on the stack.  */
  479.   int n_named_args;
  480.   /* Count arg position in order args appear.  */
  481.   int argpos;
  482.  
  483.   /* Vector of information about each argument.
  484.      Arguments are numbered in the order they will be pushed,
  485.      not the order they are written.  */
  486.   struct arg_data *args;
  487.  
  488.   /* Total size in bytes of all the stack-parms scanned so far.  */
  489.   struct args_size args_size;
  490.   /* Size of arguments before any adjustments (such as rounding).  */
  491.   struct args_size original_args_size;
  492.   /* Data on reg parms scanned so far.  */
  493.   CUMULATIVE_ARGS args_so_far;
  494.   /* Nonzero if a reg parm has been scanned.  */
  495.   int reg_parm_seen;
  496.   /* Nonzero if this is an indirect function call.  */
  497.   int current_call_is_indirect = 0;
  498.  
  499.   /* Nonzero if we must avoid push-insns in the args for this call. 
  500.      If stack space is allocated for register parameters, but not by the
  501.      caller, then it is preallocated in the fixed part of the stack frame.
  502.      So the entire argument block must then be preallocated (i.e., we
  503.      ignore PUSH_ROUNDING in that case).  */
  504.  
  505. #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
  506.   int must_preallocate = 1;
  507. #else
  508. #ifdef PUSH_ROUNDING
  509.   int must_preallocate = 0;
  510. #else
  511.   int must_preallocate = 1;
  512. #endif
  513. #endif
  514.  
  515.   /* Size of the stack reserved for parameter registers.  */
  516.   int reg_parm_stack_space = 0;
  517.  
  518.   /* 1 if scanning parms front to back, -1 if scanning back to front.  */
  519.   int inc;
  520.   /* Address of space preallocated for stack parms
  521.      (on machines that lack push insns), or 0 if space not preallocated.  */
  522.   rtx argblock = 0;
  523.  
  524.   /* Nonzero if it is plausible that this is a call to alloca.  */
  525.   int may_be_alloca;
  526.   /* Nonzero if this is a call to setjmp or a related function.  */
  527.   int returns_twice;
  528.   /* Nonzero if this is a call to `longjmp'.  */
  529.   int is_longjmp;
  530.   /* Nonzero if this is a call to an inline function.  */
  531.   int is_integrable = 0;
  532.   /* Nonzero if this is a call to a `const' function.
  533.      Note that only explicitly named functions are handled as `const' here.  */
  534.   int is_const = 0;
  535.   /* Nonzero if this is a call to a `volatile' function.  */
  536.   int is_volatile = 0;
  537. #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
  538.   /* Define the boundary of the register parm stack space that needs to be
  539.      save, if any.  */
  540.   int low_to_save = -1, high_to_save;
  541.   rtx save_area = 0;        /* Place that it is saved */
  542. #endif
  543.  
  544. #ifdef ACCUMULATE_OUTGOING_ARGS
  545.   int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
  546.   char *initial_stack_usage_map = stack_usage_map;
  547. #endif
  548.  
  549.   rtx old_stack_level = 0;
  550.   int old_pending_adj;
  551.   int old_stack_arg_under_construction;
  552.   int old_inhibit_defer_pop = inhibit_defer_pop;
  553.   tree old_cleanups = cleanups_this_call;
  554.  
  555.   rtx use_insns = 0;
  556.  
  557.   register tree p;
  558.   register int i, j;
  559.  
  560.   /* See if we can find a DECL-node for the actual function.
  561.      As a result, decide whether this is a call to an integrable function.  */
  562.  
  563.   p = TREE_OPERAND (exp, 0);
  564.   if (TREE_CODE (p) == ADDR_EXPR)
  565.     {
  566.       fndecl = TREE_OPERAND (p, 0);
  567.       if (TREE_CODE (fndecl) != FUNCTION_DECL)
  568.     {
  569.       /* May still be a `const' function if it is
  570.          a call through a pointer-to-const.
  571.          But we don't handle that.  */
  572.       fndecl = 0;
  573.     }
  574.       else
  575.     {
  576.       if (!flag_no_inline
  577.           && fndecl != current_function_decl
  578.           && DECL_SAVED_INSNS (fndecl))
  579.         is_integrable = 1;
  580.       else if (! TREE_ADDRESSABLE (fndecl))
  581.         {
  582.           /* In case this function later becomes inlinable,
  583.          record that there was already a non-inline call to it.
  584.  
  585.          Use abstraction instead of setting TREE_ADDRESSABLE
  586.          directly.  */
  587.           if (DECL_INLINE (fndecl) && extra_warnings && warn_inline
  588.           && !flag_no_inline)
  589.         warning_with_decl (fndecl, "can't inline call to `%s' which was declared inline");
  590.           mark_addressable (fndecl);
  591.         }
  592.  
  593.       if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl)
  594.           && TYPE_MODE (TREE_TYPE (exp)) != VOIDmode)
  595.         is_const = 1;
  596.  
  597.       if (TREE_THIS_VOLATILE (fndecl))
  598.         is_volatile = 1;
  599.     }
  600.     }
  601.  
  602. #ifdef REG_PARM_STACK_SPACE
  603. #ifdef MAYBE_REG_PARM_STACK_SPACE
  604.   reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
  605. #else
  606.   reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
  607. #endif
  608. #endif
  609.  
  610.   /* Warn if this value is an aggregate type,
  611.      regardless of which calling convention we are using for it.  */
  612.   if (warn_aggregate_return
  613.       && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
  614.       || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
  615.       || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE
  616.       || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE))
  617.     warning ("function call has aggregate value");
  618.  
  619.   /* Set up a place to return a structure.  */
  620.  
  621.   /* Cater to broken compilers.  */
  622.   if (aggregate_value_p (exp))
  623.     {
  624.       /* This call returns a big structure.  */
  625.       is_const = 0;
  626.  
  627. #ifdef PCC_STATIC_STRUCT_RETURN
  628.       {
  629.     pcc_struct_value = 1;
  630.     is_integrable = 0;  /* Easier than making that case work right.  */
  631.       }
  632. #else /* not PCC_STATIC_STRUCT_RETURN */
  633.       {
  634.     struct_value_size = int_size_in_bytes (TREE_TYPE (exp));
  635.  
  636.     if (struct_value_size < 0)
  637.       abort ();
  638.  
  639.     if (target && GET_CODE (target) == MEM)
  640.       structure_value_addr = XEXP (target, 0);
  641.     else
  642.       {
  643.         /* Assign a temporary on the stack to hold the value.  */
  644.  
  645.         /* For variable-sized objects, we must be called with a target
  646.            specified.  If we were to allocate space on the stack here,
  647.            we would have no way of knowing when to free it.  */
  648.  
  649.         structure_value_addr
  650.           = XEXP (assign_stack_temp (BLKmode, struct_value_size, 1), 0);
  651.         target = 0;
  652.       }
  653.       }
  654. #endif /* not PCC_STATIC_STRUCT_RETURN */
  655.     }
  656.  
  657.   /* If called function is inline, try to integrate it.  */
  658.  
  659.   if (is_integrable)
  660.     {
  661.       rtx temp;
  662.       rtx before_call = get_last_insn ();
  663.  
  664.       temp = expand_inline_function (fndecl, actparms, target,
  665.                      ignore, TREE_TYPE (exp),
  666.                      structure_value_addr);
  667.  
  668.       /* If inlining succeeded, return.  */
  669.       if ((HOST_WIDE_INT) temp != -1)
  670.     {
  671.       /* Perform all cleanups needed for the arguments of this call
  672.          (i.e. destructors in C++).  It is ok if these destructors
  673.          clobber RETURN_VALUE_REG, because the only time we care about
  674.          this is when TARGET is that register.  But in C++, we take
  675.          care to never return that register directly.  */
  676.       expand_cleanups_to (old_cleanups);
  677.  
  678. #ifdef ACCUMULATE_OUTGOING_ARGS
  679.       /* If the outgoing argument list must be preserved, push
  680.          the stack before executing the inlined function if it
  681.          makes any calls.  */
  682.  
  683.       for (i = reg_parm_stack_space - 1; i >= 0; i--)
  684.         if (i < highest_outgoing_arg_in_use && stack_usage_map[i] != 0)
  685.           break;
  686.  
  687.       if (stack_arg_under_construction || i >= 0)
  688.         {
  689.           rtx insn = NEXT_INSN (before_call), seq;
  690.  
  691.           /* Look for a call in the inline function code.
  692.          If OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) is
  693.          nonzero then there is a call and it is not necessary
  694.          to scan the insns.  */
  695.  
  696.           if (OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) == 0)
  697.         for (; insn; insn = NEXT_INSN (insn))
  698.           if (GET_CODE (insn) == CALL_INSN)
  699.             break;
  700.  
  701.           if (insn)
  702.         {
  703.           /* Reserve enough stack space so that the largest
  704.              argument list of any function call in the inline
  705.              function does not overlap the argument list being
  706.              evaluated.  This is usually an overestimate because
  707.              allocate_dynamic_stack_space reserves space for an
  708.              outgoing argument list in addition to the requested
  709.              space, but there is no way to ask for stack space such
  710.              that an argument list of a certain length can be
  711.              safely constructed.  */
  712.  
  713.           int adjust = OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl));
  714. #ifdef REG_PARM_STACK_SPACE
  715.           /* Add the stack space reserved for register arguments
  716.              in the inline function.  What is really needed is the
  717.              largest value of reg_parm_stack_space in the inline
  718.              function, but that is not available.  Using the current
  719.              value of reg_parm_stack_space is wrong, but gives
  720.              correct results on all supported machines.  */
  721.           adjust += reg_parm_stack_space;
  722. #endif
  723.           start_sequence ();
  724.           emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
  725.           allocate_dynamic_stack_space (GEN_INT (adjust),
  726.                         NULL_RTX, BITS_PER_UNIT);
  727.           seq = get_insns ();
  728.           end_sequence ();
  729.           emit_insns_before (seq, NEXT_INSN (before_call));
  730.           emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
  731.         }
  732.         }
  733. #endif
  734.  
  735.       /* If the result is equivalent to TARGET, return TARGET to simplify
  736.          checks in store_expr.  They can be equivalent but not equal in the
  737.          case of a function that returns BLKmode.  */
  738.       if (temp != target && rtx_equal_p (temp, target))
  739.         return target;
  740.       return temp;
  741.     }
  742.  
  743.       /* If inlining failed, mark FNDECL as needing to be compiled
  744.      separately after all.  */
  745.       mark_addressable (fndecl);
  746.     }
  747.  
  748.   /* When calling a const function, we must pop the stack args right away,
  749.      so that the pop is deleted or moved with the call.  */
  750.   if (is_const)
  751.     NO_DEFER_POP;
  752.  
  753.   function_call_count++;
  754.  
  755.   if (fndecl && DECL_NAME (fndecl))
  756.     name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
  757.  
  758.   /* On some machines (such as the PA) indirect calls have a different
  759.      calling convention than normal calls.  FUNCTION_ARG in the target
  760.      description can look at current_call_is_indirect to determine which
  761.      calling convention to use.  */
  762.   current_call_is_indirect = (fndecl == 0);
  763. #if 0
  764.     = TREE_CODE (TREE_OPERAND (exp, 0)) == NON_LVALUE_EXPR ? 1 : 0;
  765. #endif
  766.  
  767. #if 0
  768.   /* Unless it's a call to a specific function that isn't alloca,
  769.      if it has one argument, we must assume it might be alloca.  */
  770.  
  771.   may_be_alloca =
  772.     (!(fndecl != 0 && strcmp (name, "alloca"))
  773.      && actparms != 0
  774.      && TREE_CHAIN (actparms) == 0);
  775. #else
  776.   /* We assume that alloca will always be called by name.  It
  777.      makes no sense to pass it as a pointer-to-function to
  778.      anything that does not understand its behavior.  */
  779.   may_be_alloca =
  780.     (name && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 6
  781.          && name[0] == 'a'
  782.          && ! strcmp (name, "alloca"))
  783.         || (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 16
  784.             && name[0] == '_'
  785.             && ! strcmp (name, "__builtin_alloca"))));
  786. #endif
  787.  
  788.   /* See if this is a call to a function that can return more than once
  789.      or a call to longjmp.  */
  790.  
  791.   returns_twice = 0;
  792.   is_longjmp = 0;
  793.  
  794.   if (name != 0 && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 15)
  795.     {
  796.       char *tname = name;
  797.  
  798.       /* Disregard prefix _, __ or __x.  */
  799.       if (name[0] == '_')
  800.     {
  801.       if (name[1] == '_' && name[2] == 'x')
  802.         tname += 3;
  803.       else if (name[1] == '_')
  804.         tname += 2;
  805.       else
  806.         tname += 1;
  807.     }
  808.  
  809.       if (tname[0] == 's')
  810.     {
  811.       returns_twice
  812.         = ((tname[1] == 'e'
  813.         && (! strcmp (tname, "setjmp")
  814.             || ! strcmp (tname, "setjmp_syscall")))
  815.            || (tname[1] == 'i'
  816.            && ! strcmp (tname, "sigsetjmp"))
  817.            || (tname[1] == 'a'
  818.            && ! strcmp (tname, "savectx")));
  819.       if (tname[1] == 'i'
  820.           && ! strcmp (tname, "siglongjmp"))
  821.         is_longjmp = 1;
  822.     }
  823.       else if ((tname[0] == 'q' && tname[1] == 's'
  824.         && ! strcmp (tname, "qsetjmp"))
  825.            || (tname[0] == 'v' && tname[1] == 'f'
  826.            && ! strcmp (tname, "vfork")))
  827.     returns_twice = 1;
  828.  
  829.       else if (tname[0] == 'l' && tname[1] == 'o'
  830.            && ! strcmp (tname, "longjmp"))
  831.     is_longjmp = 1;
  832.     }
  833.  
  834.   if (may_be_alloca)
  835.     current_function_calls_alloca = 1;
  836.  
  837.   /* Don't let pending stack adjusts add up to too much.
  838.      Also, do all pending adjustments now
  839.      if there is any chance this might be a call to alloca.  */
  840.  
  841.   if (pending_stack_adjust >= 32
  842.       || (pending_stack_adjust > 0 && may_be_alloca))
  843.     do_pending_stack_adjust ();
  844.  
  845.   /* Operand 0 is a pointer-to-function; get the type of the function.  */
  846.   funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
  847.   if (TREE_CODE (funtype) != POINTER_TYPE)
  848.     abort ();
  849.   funtype = TREE_TYPE (funtype);
  850.  
  851.   /* Push the temporary stack slot level so that we can free temporaries used
  852.      by each of the arguments separately.  */
  853.   push_temp_slots ();
  854.  
  855.   /* Start updating where the next arg would go.  */
  856.   INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_RTX);
  857.  
  858.   /* If struct_value_rtx is 0, it means pass the address
  859.      as if it were an extra parameter.  */
  860.   if (structure_value_addr && struct_value_rtx == 0)
  861.     {
  862. #ifdef ACCUMULATE_OUTGOING_ARGS
  863.       /* If the stack will be adjusted, make sure the structure address
  864.      does not refer to virtual_outgoing_args_rtx.  */
  865.       rtx temp = (stack_arg_under_construction
  866.           ? copy_addr_to_reg (structure_value_addr)
  867.           : force_reg (Pmode, structure_value_addr));
  868. #else
  869.       rtx temp = force_reg (Pmode, structure_value_addr);
  870. #endif
  871.  
  872.       actparms
  873.     = tree_cons (error_mark_node,
  874.              make_tree (build_pointer_type (TREE_TYPE (funtype)),
  875.                 temp),
  876.              actparms);
  877.       structure_value_addr_parm = 1;
  878.     }
  879.  
  880.   /* Count the arguments and set NUM_ACTUALS.  */
  881.   for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
  882.   num_actuals = i;
  883.  
  884.   /* Compute number of named args.
  885.      Normally, don't include the last named arg if anonymous args follow.
  886.      (If no anonymous args follow, the result of list_length
  887.      is actually one too large.)
  888.  
  889.      If SETUP_INCOMING_VARARGS is defined, this machine will be able to
  890.      place unnamed args that were passed in registers into the stack.  So
  891.      treat all args as named.  This allows the insns emitting for a specific
  892.      argument list to be independent of the function declaration.
  893.  
  894.      If SETUP_INCOMING_VARARGS is not defined, we do not have any reliable
  895.      way to pass unnamed args in registers, so we must force them into
  896.      memory.  */
  897. #ifndef SETUP_INCOMING_VARARGS
  898.   if (TYPE_ARG_TYPES (funtype) != 0)
  899.     n_named_args
  900.       = list_length (TYPE_ARG_TYPES (funtype)) - 1
  901.     /* Count the struct value address, if it is passed as a parm.  */
  902.     + structure_value_addr_parm;
  903.   else
  904. #endif
  905.     /* If we know nothing, treat all args as named.  */
  906.     n_named_args = num_actuals;
  907.  
  908.   /* Make a vector to hold all the information about each arg.  */
  909.   args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
  910.   bzero (args, num_actuals * sizeof (struct arg_data));
  911.  
  912.   args_size.constant = 0;
  913.   args_size.var = 0;
  914.  
  915.   /* In this loop, we consider args in the order they are written.
  916.      We fill up ARGS from the front of from the back if necessary
  917.      so that in any case the first arg to be pushed ends up at the front.  */
  918.  
  919. #ifdef PUSH_ARGS_REVERSED
  920.   i = num_actuals - 1, inc = -1;
  921.   /* In this case, must reverse order of args
  922.      so that we compute and push the last arg first.  */
  923. #else
  924.   i = 0, inc = 1;
  925. #endif
  926.  
  927.   /* I counts args in order (to be) pushed; ARGPOS counts in order written.  */
  928.   for (p = actparms, argpos = 0; p; p = TREE_CHAIN (p), i += inc, argpos++)
  929.     {
  930.       tree type = TREE_TYPE (TREE_VALUE (p));
  931.       enum machine_mode mode;
  932.  
  933.       args[i].tree_value = TREE_VALUE (p);
  934.  
  935.       /* Replace erroneous argument with constant zero.  */
  936.       if (type == error_mark_node || TYPE_SIZE (type) == 0)
  937.     args[i].tree_value = integer_zero_node, type = integer_type_node;
  938.  
  939.       /* Decide where to pass this arg.
  940.  
  941.      args[i].reg is nonzero if all or part is passed in registers.
  942.  
  943.      args[i].partial is nonzero if part but not all is passed in registers,
  944.      and the exact value says how many words are passed in registers.
  945.  
  946.      args[i].pass_on_stack is nonzero if the argument must at least be
  947.      computed on the stack.  It may then be loaded back into registers
  948.      if args[i].reg is nonzero.
  949.  
  950.      These decisions are driven by the FUNCTION_... macros and must agree
  951.      with those made by function.c.  */
  952.  
  953.       /* See if this argument should be passed by invisible reference.  */
  954.       if ((TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
  955.        && contains_placeholder_p (TYPE_SIZE (type)))
  956. #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
  957.       || FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, TYPE_MODE (type),
  958.                          type, argpos < n_named_args)
  959. #endif
  960.       )
  961.     {
  962. #ifdef FUNCTION_ARG_CALLEE_COPIES
  963.       if (FUNCTION_ARG_CALLEE_COPIES (args_so_far, TYPE_MODE (type), type,
  964.                       argpos < n_named_args)
  965.           /* If it's in a register, we must make a copy of it too.  */
  966.           /* ??? Is this a sufficient test?  Is there a better one? */
  967.           && !(TREE_CODE (args[i].tree_value) == VAR_DECL
  968.            && REG_P (DECL_RTL (args[i].tree_value))))
  969.         {
  970.           args[i].tree_value = build1 (ADDR_EXPR,
  971.                        build_pointer_type (type),
  972.                        args[i].tree_value);
  973.           type = build_pointer_type (type);
  974.         }
  975.       else
  976. #endif
  977.         {
  978.           /* We make a copy of the object and pass the address to the
  979.          function being called.  */
  980.           rtx copy;
  981.  
  982.           if (TYPE_SIZE (type) == 0
  983.           || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
  984.         {
  985.           /* This is a variable-sized object.  Make space on the stack
  986.              for it.  */
  987.           rtx size_rtx = expr_size (TREE_VALUE (p));
  988.  
  989.           if (old_stack_level == 0)
  990.             {
  991.               emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
  992.               old_pending_adj = pending_stack_adjust;
  993.               pending_stack_adjust = 0;
  994.             }
  995.  
  996.           copy = gen_rtx (MEM, BLKmode,
  997.                   allocate_dynamic_stack_space (size_rtx,
  998.                                 NULL_RTX,
  999.                                 TYPE_ALIGN (type)));
  1000.         }
  1001.           else
  1002.         {
  1003.           int size = int_size_in_bytes (type);
  1004.           copy = assign_stack_temp (TYPE_MODE (type), size, 1);
  1005.         }
  1006.  
  1007.           MEM_IN_STRUCT_P (copy)
  1008.         = (TREE_CODE (type) == RECORD_TYPE
  1009.            || TREE_CODE (type) == UNION_TYPE
  1010.            || TREE_CODE (type) == QUAL_UNION_TYPE
  1011.            || TREE_CODE (type) == ARRAY_TYPE);
  1012.  
  1013.           store_expr (args[i].tree_value, copy, 0);
  1014.  
  1015.           args[i].tree_value = build1 (ADDR_EXPR,
  1016.                        build_pointer_type (type),
  1017.                        make_tree (type, copy));
  1018.           type = build_pointer_type (type);
  1019.         }
  1020.     }
  1021.  
  1022.       mode = TYPE_MODE (type);
  1023.  
  1024. #ifdef PROMOTE_FUNCTION_ARGS
  1025.       /* Compute the mode in which the arg is actually to be extended to.  */
  1026.       if (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == ENUMERAL_TYPE
  1027.       || TREE_CODE (type) == BOOLEAN_TYPE || TREE_CODE (type) == CHAR_TYPE
  1028.       || TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == POINTER_TYPE
  1029.       || TREE_CODE (type) == OFFSET_TYPE)
  1030.     {
  1031.       int unsignedp = TREE_UNSIGNED (type);
  1032.       PROMOTE_MODE (mode, unsignedp, type);
  1033.       args[i].unsignedp = unsignedp;
  1034.     }
  1035. #endif
  1036.  
  1037.       args[i].mode = mode;
  1038.       args[i].reg = FUNCTION_ARG (args_so_far, mode, type,
  1039.                   argpos < n_named_args);
  1040. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  1041.       if (args[i].reg)
  1042.     args[i].partial
  1043.       = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, type,
  1044.                     argpos < n_named_args);
  1045. #endif
  1046.  
  1047.       args[i].pass_on_stack = MUST_PASS_IN_STACK (mode, type);
  1048.  
  1049.       /* If FUNCTION_ARG returned an (expr_list (nil) FOO), it means that
  1050.      we are to pass this arg in the register(s) designated by FOO, but
  1051.      also to pass it in the stack.  */
  1052.       if (args[i].reg && GET_CODE (args[i].reg) == EXPR_LIST
  1053.       && XEXP (args[i].reg, 0) == 0)
  1054.     args[i].pass_on_stack = 1, args[i].reg = XEXP (args[i].reg, 1);
  1055.  
  1056.       /* If this is an addressable type, we must preallocate the stack
  1057.      since we must evaluate the object into its final location.
  1058.  
  1059.      If this is to be passed in both registers and the stack, it is simpler
  1060.      to preallocate.  */
  1061.       if (TREE_ADDRESSABLE (type)
  1062.       || (args[i].pass_on_stack && args[i].reg != 0))
  1063.     must_preallocate = 1;
  1064.  
  1065.       /* If this is an addressable type, we cannot pre-evaluate it.  Thus,
  1066.      we cannot consider this function call constant.  */
  1067.       if (TREE_ADDRESSABLE (type))
  1068.     is_const = 0;
  1069.  
  1070.       /* Compute the stack-size of this argument.  */
  1071.       if (args[i].reg == 0 || args[i].partial != 0
  1072. #ifdef REG_PARM_STACK_SPACE
  1073.       || reg_parm_stack_space > 0
  1074. #endif
  1075.       || args[i].pass_on_stack)
  1076.     locate_and_pad_parm (mode, type,
  1077. #ifdef STACK_PARMS_IN_REG_PARM_AREA
  1078.                  1,
  1079. #else
  1080.                  args[i].reg != 0,
  1081. #endif
  1082.                  fndecl, &args_size, &args[i].offset,
  1083.                  &args[i].size);
  1084.  
  1085. #ifndef ARGS_GROW_DOWNWARD
  1086.       args[i].slot_offset = args_size;
  1087. #endif
  1088.  
  1089. #ifndef REG_PARM_STACK_SPACE
  1090.       /* If a part of the arg was put into registers,
  1091.      don't include that part in the amount pushed.  */
  1092.       if (! args[i].pass_on_stack)
  1093.     args[i].size.constant -= ((args[i].partial * UNITS_PER_WORD)
  1094.                   / (PARM_BOUNDARY / BITS_PER_UNIT)
  1095.                   * (PARM_BOUNDARY / BITS_PER_UNIT));
  1096. #endif
  1097.       
  1098.       /* Update ARGS_SIZE, the total stack space for args so far.  */
  1099.  
  1100.       args_size.constant += args[i].size.constant;
  1101.       if (args[i].size.var)
  1102.     {
  1103.       ADD_PARM_SIZE (args_size, args[i].size.var);
  1104.     }
  1105.  
  1106.       /* Since the slot offset points to the bottom of the slot,
  1107.      we must record it after incrementing if the args grow down.  */
  1108. #ifdef ARGS_GROW_DOWNWARD
  1109.       args[i].slot_offset = args_size;
  1110.  
  1111.       args[i].slot_offset.constant = -args_size.constant;
  1112.       if (args_size.var)
  1113.     {
  1114.       SUB_PARM_SIZE (args[i].slot_offset, args_size.var);
  1115.     }
  1116. #endif
  1117.  
  1118.       /* Increment ARGS_SO_FAR, which has info about which arg-registers
  1119.      have been used, etc.  */
  1120.  
  1121.       FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
  1122.                 argpos < n_named_args);
  1123.     }
  1124.  
  1125. #ifdef FINAL_REG_PARM_STACK_SPACE
  1126.   reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
  1127.                              args_size.var);
  1128. #endif
  1129.       
  1130.   /* Compute the actual size of the argument block required.  The variable
  1131.      and constant sizes must be combined, the size may have to be rounded,
  1132.      and there may be a minimum required size.  */
  1133.  
  1134.   original_args_size = args_size;
  1135.   if (args_size.var)
  1136.     {
  1137.       /* If this function requires a variable-sized argument list, don't try to
  1138.      make a cse'able block for this call.  We may be able to do this
  1139.      eventually, but it is too complicated to keep track of what insns go
  1140.      in the cse'able block and which don't.  */
  1141.  
  1142.       is_const = 0;
  1143.       must_preallocate = 1;
  1144.  
  1145.       args_size.var = ARGS_SIZE_TREE (args_size);
  1146.       args_size.constant = 0;
  1147.  
  1148. #ifdef STACK_BOUNDARY
  1149.       if (STACK_BOUNDARY != BITS_PER_UNIT)
  1150.     args_size.var = round_up (args_size.var, STACK_BYTES);
  1151. #endif
  1152.  
  1153. #ifdef REG_PARM_STACK_SPACE
  1154.       if (reg_parm_stack_space > 0)
  1155.     {
  1156.       args_size.var
  1157.         = size_binop (MAX_EXPR, args_size.var,
  1158.               size_int (REG_PARM_STACK_SPACE (fndecl)));
  1159.  
  1160. #ifndef OUTGOING_REG_PARM_STACK_SPACE
  1161.       /* The area corresponding to register parameters is not to count in
  1162.          the size of the block we need.  So make the adjustment.  */
  1163.       args_size.var
  1164.         = size_binop (MINUS_EXPR, args_size.var,
  1165.               size_int (reg_parm_stack_space));
  1166. #endif
  1167.     }
  1168. #endif
  1169.     }
  1170.   else
  1171.     {
  1172. #ifdef STACK_BOUNDARY
  1173.       args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
  1174.                  / STACK_BYTES) * STACK_BYTES);
  1175. #endif
  1176.  
  1177. #ifdef REG_PARM_STACK_SPACE
  1178.       args_size.constant = MAX (args_size.constant,
  1179.                 reg_parm_stack_space);
  1180. #ifdef MAYBE_REG_PARM_STACK_SPACE
  1181.       if (reg_parm_stack_space == 0)
  1182.     args_size.constant = 0;
  1183. #endif
  1184. #ifndef OUTGOING_REG_PARM_STACK_SPACE
  1185.       args_size.constant -= reg_parm_stack_space;
  1186. #endif
  1187. #endif
  1188.     }
  1189.  
  1190.   /* See if we have or want to preallocate stack space.
  1191.  
  1192.      If we would have to push a partially-in-regs parm
  1193.      before other stack parms, preallocate stack space instead.
  1194.  
  1195.      If the size of some parm is not a multiple of the required stack
  1196.      alignment, we must preallocate.
  1197.  
  1198.      If the total size of arguments that would otherwise create a copy in
  1199.      a temporary (such as a CALL) is more than half the total argument list
  1200.      size, preallocation is faster.
  1201.  
  1202.      Another reason to preallocate is if we have a machine (like the m88k)
  1203.      where stack alignment is required to be maintained between every
  1204.      pair of insns, not just when the call is made.  However, we assume here
  1205.      that such machines either do not have push insns (and hence preallocation
  1206.      would occur anyway) or the problem is taken care of with
  1207.      PUSH_ROUNDING.  */
  1208.  
  1209.   if (! must_preallocate)
  1210.     {
  1211.       int partial_seen = 0;
  1212.       int copy_to_evaluate_size = 0;
  1213.  
  1214.       for (i = 0; i < num_actuals && ! must_preallocate; i++)
  1215.     {
  1216.       if (args[i].partial > 0 && ! args[i].pass_on_stack)
  1217.         partial_seen = 1;
  1218.       else if (partial_seen && args[i].reg == 0)
  1219.         must_preallocate = 1;
  1220.  
  1221.       if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
  1222.           && (TREE_CODE (args[i].tree_value) == CALL_EXPR
  1223.           || TREE_CODE (args[i].tree_value) == TARGET_EXPR
  1224.           || TREE_CODE (args[i].tree_value) == COND_EXPR
  1225.           || TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))))
  1226.         copy_to_evaluate_size
  1227.           += int_size_in_bytes (TREE_TYPE (args[i].tree_value));
  1228.     }
  1229.  
  1230.       if (copy_to_evaluate_size * 2 >= args_size.constant
  1231.       && args_size.constant > 0)
  1232.     must_preallocate = 1;
  1233.     }
  1234.  
  1235.   /* If the structure value address will reference the stack pointer, we must
  1236.      stabilize it.  We don't need to do this if we know that we are not going
  1237.      to adjust the stack pointer in processing this call.  */
  1238.  
  1239.   if (structure_value_addr
  1240.       && (reg_mentioned_p (virtual_stack_dynamic_rtx, structure_value_addr)
  1241.        || reg_mentioned_p (virtual_outgoing_args_rtx, structure_value_addr))
  1242.       && (args_size.var
  1243. #ifndef ACCUMULATE_OUTGOING_ARGS
  1244.       || args_size.constant
  1245. #endif
  1246.       ))
  1247.     structure_value_addr = copy_to_reg (structure_value_addr);
  1248.  
  1249.   /* If this function call is cse'able, precompute all the parameters.
  1250.      Note that if the parameter is constructed into a temporary, this will
  1251.      cause an additional copy because the parameter will be constructed
  1252.      into a temporary location and then copied into the outgoing arguments.
  1253.      If a parameter contains a call to alloca and this function uses the
  1254.      stack, precompute the parameter.  */
  1255.  
  1256.   /* If we preallocated the stack space, and some arguments must be passed
  1257.      on the stack, then we must precompute any parameter which contains a
  1258.      function call which will store arguments on the stack.
  1259.      Otherwise, evaluating the parameter may clobber previous parameters
  1260.      which have already been stored into the stack.  */
  1261.  
  1262.   for (i = 0; i < num_actuals; i++)
  1263.     if (is_const
  1264.     || ((args_size.var != 0 || args_size.constant != 0)
  1265.         && calls_function (args[i].tree_value, 1))
  1266.     || (must_preallocate && (args_size.var != 0 || args_size.constant != 0)
  1267.         && calls_function (args[i].tree_value, 0)))
  1268.       {
  1269.     args[i].initial_value = args[i].value
  1270.       = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
  1271.  
  1272.     if (GET_MODE (args[i].value ) != VOIDmode
  1273.         && GET_MODE (args[i].value) != args[i].mode)
  1274.       args[i].value = convert_to_mode (args[i].mode, args[i].value,
  1275.                        args[i].unsignedp);
  1276.     preserve_temp_slots (args[i].value);
  1277.  
  1278.     free_temp_slots ();
  1279.  
  1280.     /* ANSI doesn't require a sequence point here,
  1281.        but PCC has one, so this will avoid some problems.  */
  1282.     emit_queue ();
  1283.       }
  1284.  
  1285.   /* Now we are about to start emitting insns that can be deleted
  1286.      if a libcall is deleted.  */
  1287.   if (is_const)
  1288.     start_sequence ();
  1289.  
  1290.   /* If we have no actual push instructions, or shouldn't use them,
  1291.      make space for all args right now.  */
  1292.  
  1293.   if (args_size.var != 0)
  1294.     {
  1295.       if (old_stack_level == 0)
  1296.     {
  1297.       emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
  1298.       old_pending_adj = pending_stack_adjust;
  1299.       pending_stack_adjust = 0;
  1300. #ifdef ACCUMULATE_OUTGOING_ARGS
  1301.       /* stack_arg_under_construction says whether a stack arg is
  1302.          being constructed at the old stack level.  Pushing the stack
  1303.          gets a clean outgoing argument block.  */
  1304.       old_stack_arg_under_construction = stack_arg_under_construction;
  1305.       stack_arg_under_construction = 0;
  1306. #endif
  1307.     }
  1308.       argblock = push_block (ARGS_SIZE_RTX (args_size), 0, 0);
  1309.     }
  1310.   else if (must_preallocate)
  1311.     {
  1312.       /* Note that we must go through the motions of allocating an argument
  1313.      block even if the size is zero because we may be storing args
  1314.      in the area reserved for register arguments, which may be part of
  1315.      the stack frame.  */
  1316.       int needed = args_size.constant;
  1317.  
  1318. #ifdef ACCUMULATE_OUTGOING_ARGS
  1319.       /* Store the maximum argument space used.  It will be pushed by the
  1320.      prologue.
  1321.  
  1322.      Since the stack pointer will never be pushed, it is possible for
  1323.      the evaluation of a parm to clobber something we have already
  1324.      written to the stack.  Since most function calls on RISC machines
  1325.      do not use the stack, this is uncommon, but must work correctly.
  1326.      
  1327.      Therefore, we save any area of the stack that was already written
  1328.      and that we are using.  Here we set up to do this by making a new
  1329.      stack usage map from the old one.  The actual save will be done
  1330.      by store_one_arg. 
  1331.  
  1332.      Another approach might be to try to reorder the argument
  1333.      evaluations to avoid this conflicting stack usage.  */
  1334.  
  1335.       if (needed > current_function_outgoing_args_size)
  1336.     current_function_outgoing_args_size = needed;
  1337.  
  1338. #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
  1339.       /* Since we will be writing into the entire argument area, the
  1340.      map must be allocated for its entire size, not just the part that
  1341.      is the responsibility of the caller.  */
  1342.       needed += reg_parm_stack_space;
  1343. #endif
  1344.  
  1345. #ifdef ARGS_GROW_DOWNWARD
  1346.       highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
  1347.                      needed + 1);
  1348. #else
  1349.       highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, needed);
  1350. #endif
  1351.       stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
  1352.  
  1353.       if (initial_highest_arg_in_use)
  1354.     bcopy (initial_stack_usage_map, stack_usage_map,
  1355.            initial_highest_arg_in_use);
  1356.  
  1357.       if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
  1358.     bzero (&stack_usage_map[initial_highest_arg_in_use],
  1359.            highest_outgoing_arg_in_use - initial_highest_arg_in_use);
  1360.       needed = 0;
  1361.  
  1362.       /* The address of the outgoing argument list must not be copied to a
  1363.      register here, because argblock would be left pointing to the
  1364.      wrong place after the call to allocate_dynamic_stack_space below. */
  1365.  
  1366.       argblock = virtual_outgoing_args_rtx;
  1367.  
  1368. #else /* not ACCUMULATE_OUTGOING_ARGS */
  1369.       if (inhibit_defer_pop == 0)
  1370.     {
  1371.       /* Try to reuse some or all of the pending_stack_adjust
  1372.          to get this space.  Maybe we can avoid any pushing.  */
  1373.       if (needed > pending_stack_adjust)
  1374.         {
  1375.           needed -= pending_stack_adjust;
  1376.           pending_stack_adjust = 0;
  1377.         }
  1378.       else
  1379.         {
  1380.           pending_stack_adjust -= needed;
  1381.           needed = 0;
  1382.         }
  1383.     }
  1384.       /* Special case this because overhead of `push_block' in this
  1385.      case is non-trivial.  */
  1386.       if (needed == 0)
  1387.     argblock = virtual_outgoing_args_rtx;
  1388.       else
  1389.     argblock = push_block (GEN_INT (needed), 0, 0);
  1390.  
  1391.       /* We only really need to call `copy_to_reg' in the case where push
  1392.      insns are going to be used to pass ARGBLOCK to a function
  1393.      call in ARGS.  In that case, the stack pointer changes value
  1394.      from the allocation point to the call point, and hence
  1395.      the value of VIRTUAL_OUTGOING_ARGS_RTX changes as well.
  1396.      But might as well always do it.  */
  1397.       argblock = copy_to_reg (argblock);
  1398. #endif /* not ACCUMULATE_OUTGOING_ARGS */
  1399.     }
  1400.  
  1401.  
  1402. #ifdef ACCUMULATE_OUTGOING_ARGS
  1403.   /* The save/restore code in store_one_arg handles all cases except one:
  1404.      a constructor call (including a C function returning a BLKmode struct)
  1405.      to initialize an argument.  */
  1406.   if (stack_arg_under_construction)
  1407.     {
  1408. #if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
  1409.       rtx push_size = GEN_INT (reg_parm_stack_space + args_size.constant);
  1410. #else
  1411.       rtx push_size = GEN_INT (args_size.constant);
  1412. #endif
  1413.       if (old_stack_level == 0)
  1414.     {
  1415.       emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
  1416.       old_pending_adj = pending_stack_adjust;
  1417.       pending_stack_adjust = 0;
  1418.       /* stack_arg_under_construction says whether a stack arg is
  1419.          being constructed at the old stack level.  Pushing the stack
  1420.          gets a clean outgoing argument block.  */
  1421.       old_stack_arg_under_construction = stack_arg_under_construction;
  1422.       stack_arg_under_construction = 0;
  1423.       /* Make a new map for the new argument list.  */
  1424.       stack_usage_map = (char *)alloca (highest_outgoing_arg_in_use);
  1425.       bzero (stack_usage_map, highest_outgoing_arg_in_use);
  1426.       highest_outgoing_arg_in_use = 0;
  1427.     }
  1428.       allocate_dynamic_stack_space (push_size, NULL_RTX, BITS_PER_UNIT);
  1429.     }
  1430.   /* If argument evaluation might modify the stack pointer, copy the
  1431.      address of the argument list to a register.  */
  1432.   for (i = 0; i < num_actuals; i++)
  1433.     if (args[i].pass_on_stack)
  1434.       {
  1435.     argblock = copy_addr_to_reg (argblock);
  1436.     break;
  1437.       }
  1438. #endif
  1439.  
  1440.  
  1441.   /* If we preallocated stack space, compute the address of each argument.
  1442.      We need not ensure it is a valid memory address here; it will be 
  1443.      validized when it is used.  */
  1444.   if (argblock)
  1445.     {
  1446.       rtx arg_reg = argblock;
  1447.       int arg_offset = 0;
  1448.  
  1449.       if (GET_CODE (argblock) == PLUS)
  1450.     arg_reg = XEXP (argblock, 0), arg_offset = INTVAL (XEXP (argblock, 1));
  1451.  
  1452.       for (i = 0; i < num_actuals; i++)
  1453.     {
  1454.       rtx offset = ARGS_SIZE_RTX (args[i].offset);
  1455.       rtx slot_offset = ARGS_SIZE_RTX (args[i].slot_offset);
  1456.       rtx addr;
  1457.  
  1458.       /* Skip this parm if it will not be passed on the stack.  */
  1459.       if (! args[i].pass_on_stack && args[i].reg != 0)
  1460.         continue;
  1461.  
  1462.       if (GET_CODE (offset) == CONST_INT)
  1463.         addr = plus_constant (arg_reg, INTVAL (offset));
  1464.       else
  1465.         addr = gen_rtx (PLUS, Pmode, arg_reg, offset);
  1466.  
  1467.       addr = plus_constant (addr, arg_offset);
  1468.       args[i].stack = gen_rtx (MEM, args[i].mode, addr);
  1469.       MEM_IN_STRUCT_P (args[i].stack)
  1470.         = (TREE_CODE (TREE_TYPE (args[i].tree_value)) == RECORD_TYPE
  1471.            || TREE_CODE (TREE_TYPE (args[i].tree_value)) == UNION_TYPE
  1472.            || TREE_CODE (TREE_TYPE (args[i].tree_value)) == QUAL_UNION_TYPE
  1473.            || TREE_CODE (TREE_TYPE (args[i].tree_value)) == ARRAY_TYPE);
  1474.  
  1475.       if (GET_CODE (slot_offset) == CONST_INT)
  1476.         addr = plus_constant (arg_reg, INTVAL (slot_offset));
  1477.       else
  1478.         addr = gen_rtx (PLUS, Pmode, arg_reg, slot_offset);
  1479.  
  1480.       addr = plus_constant (addr, arg_offset);
  1481.       args[i].stack_slot = gen_rtx (MEM, args[i].mode, addr);
  1482.     }
  1483.     }
  1484.                            
  1485. #ifdef PUSH_ARGS_REVERSED
  1486. #ifdef STACK_BOUNDARY
  1487.   /* If we push args individually in reverse order, perform stack alignment
  1488.      before the first push (the last arg).  */
  1489.   if (argblock == 0)
  1490.     anti_adjust_stack (GEN_INT (args_size.constant
  1491.                 - original_args_size.constant));
  1492. #endif
  1493. #endif
  1494.  
  1495.   /* Don't try to defer pops if preallocating, not even from the first arg,
  1496.      since ARGBLOCK probably refers to the SP.  */
  1497.   if (argblock)
  1498.     NO_DEFER_POP;
  1499.  
  1500.   /* Get the function to call, in the form of RTL.  */
  1501.   if (fndecl)
  1502.     {
  1503.       /* If this is the first use of the function, see if we need to
  1504.      make an external definition for it.  */
  1505.       if (! TREE_USED (fndecl))
  1506.     {
  1507.       assemble_external (fndecl);
  1508.       TREE_USED (fndecl) = 1;
  1509.     }
  1510.  
  1511.       /* Get a SYMBOL_REF rtx for the function address.  */
  1512.       funexp = XEXP (DECL_RTL (fndecl), 0);
  1513.     }
  1514.   else
  1515.     /* Generate an rtx (probably a pseudo-register) for the address.  */
  1516.     {
  1517.       funexp = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
  1518.       free_temp_slots ();    /* FUNEXP can't be BLKmode */
  1519.       emit_queue ();
  1520.     }
  1521.  
  1522.   /* Figure out the register where the value, if any, will come back.  */
  1523.   valreg = 0;
  1524.   if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
  1525.       && ! structure_value_addr)
  1526.     {
  1527.       if (pcc_struct_value)
  1528.     valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
  1529.                       fndecl);
  1530.       else
  1531.     valreg = hard_function_value (TREE_TYPE (exp), fndecl);
  1532.     }
  1533.  
  1534.   /* Precompute all register parameters.  It isn't safe to compute anything
  1535.      once we have started filling any specific hard regs. */
  1536.   reg_parm_seen = 0;
  1537.   for (i = 0; i < num_actuals; i++)
  1538.     if (args[i].reg != 0 && ! args[i].pass_on_stack)
  1539.       {
  1540.     reg_parm_seen = 1;
  1541.  
  1542.     if (args[i].value == 0)
  1543.       {
  1544.         args[i].value = expand_expr (args[i].tree_value, NULL_RTX,
  1545.                      VOIDmode, 0);
  1546.         preserve_temp_slots (args[i].value);
  1547.         free_temp_slots ();
  1548.  
  1549.         /* ANSI doesn't require a sequence point here,
  1550.            but PCC has one, so this will avoid some problems.  */
  1551.         emit_queue ();
  1552.       }
  1553.  
  1554.     /* If we are to promote the function arg to a wider mode,
  1555.        do it now.  */
  1556.  
  1557.     if (args[i].mode != TYPE_MODE (TREE_TYPE (args[i].tree_value)))
  1558.       args[i].value
  1559.         = convert_modes (args[i].mode,
  1560.                  TYPE_MODE (TREE_TYPE (args[i].tree_value)),
  1561.                  args[i].value, args[i].unsignedp);
  1562.       }
  1563.  
  1564. #if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
  1565.   /* The argument list is the property of the called routine and it
  1566.      may clobber it.  If the fixed area has been used for previous
  1567.      parameters, we must save and restore it.
  1568.  
  1569.      Here we compute the boundary of the that needs to be saved, if any.  */
  1570.  
  1571. #ifdef ARGS_GROW_DOWNWARD
  1572.   for (i = 0; i < reg_parm_stack_space + 1; i++)
  1573. #else
  1574.   for (i = 0; i < reg_parm_stack_space; i++)
  1575. #endif
  1576.     {
  1577.       if (i >=  highest_outgoing_arg_in_use
  1578.       || stack_usage_map[i] == 0)
  1579.     continue;
  1580.  
  1581.       if (low_to_save == -1)
  1582.     low_to_save = i;
  1583.  
  1584.       high_to_save = i;
  1585.     }
  1586.  
  1587.   if (low_to_save >= 0)
  1588.     {
  1589.       int num_to_save = high_to_save - low_to_save + 1;
  1590.       enum machine_mode save_mode
  1591.     = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1);
  1592.       rtx stack_area;
  1593.  
  1594.       /* If we don't have the required alignment, must do this in BLKmode.  */
  1595.       if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode),
  1596.                    BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
  1597.     save_mode = BLKmode;
  1598.  
  1599.       stack_area = gen_rtx (MEM, save_mode,
  1600.                 memory_address (save_mode,
  1601.                         
  1602. #ifdef ARGS_GROW_DOWNWARD
  1603.                         plus_constant (argblock,
  1604.                                - high_to_save)
  1605. #else
  1606.                         plus_constant (argblock,
  1607.                                low_to_save)
  1608. #endif
  1609.                         ));
  1610.       if (save_mode == BLKmode)
  1611.     {
  1612.       save_area = assign_stack_temp (BLKmode, num_to_save, 1);
  1613.       emit_block_move (validize_mem (save_area), stack_area,
  1614.                GEN_INT (num_to_save),
  1615.                PARM_BOUNDARY / BITS_PER_UNIT);
  1616.     }
  1617.       else
  1618.     {
  1619.       save_area = gen_reg_rtx (save_mode);
  1620.       emit_move_insn (save_area, stack_area);
  1621.     }
  1622.     }
  1623. #endif
  1624.       
  1625.  
  1626.   /* Now store (and compute if necessary) all non-register parms.
  1627.      These come before register parms, since they can require block-moves,
  1628.      which could clobber the registers used for register parms.
  1629.      Parms which have partial registers are not stored here,
  1630.      but we do preallocate space here if they want that.  */
  1631.  
  1632.   for (i = 0; i < num_actuals; i++)
  1633.     if (args[i].reg == 0 || args[i].pass_on_stack)
  1634.       store_one_arg (&args[i], argblock, may_be_alloca,
  1635.              args_size.var != 0, fndecl, reg_parm_stack_space);
  1636.  
  1637. #ifdef STRICT_ALIGNMENT
  1638.   /* If we have a parm that is passed in registers but not in memory
  1639.      and whose alignment does not permit a direct copy into registers,
  1640.      make a group of pseudos that correspond to each register that we
  1641.      will later fill.  */
  1642.  
  1643.   for (i = 0; i < num_actuals; i++)
  1644.     if (args[i].reg != 0 && ! args[i].pass_on_stack
  1645.     && args[i].mode == BLKmode
  1646.     && (TYPE_ALIGN (TREE_TYPE (args[i].tree_value))
  1647.         < MIN (BIGGEST_ALIGNMENT, BITS_PER_WORD)))
  1648.       {
  1649.     int bytes = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
  1650.     int big_endian_correction = 0;
  1651.  
  1652.     args[i].n_aligned_regs
  1653.       = args[i].partial ? args[i].partial
  1654.         : (bytes + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
  1655.  
  1656.     args[i].aligned_regs = (rtx *) alloca (sizeof (rtx)
  1657.                            * args[i].n_aligned_regs);
  1658.  
  1659.     /* Structures smaller than a word are aligned to the least signifcant
  1660.        byte (to the right).  On a BYTES_BIG_ENDIAN machine, this means we
  1661.        must skip the empty high order bytes when calculating the bit
  1662.        offset.  */
  1663.     if (BYTES_BIG_ENDIAN && bytes < UNITS_PER_WORD)
  1664.       big_endian_correction = (BITS_PER_WORD  - (bytes * BITS_PER_UNIT));
  1665.  
  1666.     for (j = 0; j < args[i].n_aligned_regs; j++)
  1667.       {
  1668.         rtx reg = gen_reg_rtx (word_mode);
  1669.         rtx word = operand_subword_force (args[i].value, j, BLKmode);
  1670.         int bitsize = TYPE_ALIGN (TREE_TYPE (args[i].tree_value));
  1671.         int bitpos;
  1672.  
  1673.         args[i].aligned_regs[j] = reg;
  1674.  
  1675.         /* Clobber REG and move each partword into it.  Ensure we don't
  1676.            go past the end of the structure.  Note that the loop below
  1677.            works because we've already verified that padding
  1678.            and endianness are compatible.  */
  1679.  
  1680.         emit_insn (gen_rtx (CLOBBER, VOIDmode, reg));
  1681.  
  1682.         for (bitpos = 0;
  1683.          bitpos < BITS_PER_WORD && bytes > 0;
  1684.          bitpos += bitsize, bytes -= bitsize / BITS_PER_UNIT)
  1685.           {
  1686.         int xbitpos = bitpos + big_endian_correction;
  1687.  
  1688.         store_bit_field (reg, bitsize, xbitpos, word_mode,
  1689.                  extract_bit_field (word, bitsize, bitpos, 1,
  1690.                             NULL_RTX, word_mode,
  1691.                             word_mode,
  1692.                             bitsize / BITS_PER_UNIT,
  1693.                             BITS_PER_WORD),
  1694.                  bitsize / BITS_PER_UNIT, BITS_PER_WORD);
  1695.           }
  1696.       }
  1697.       }
  1698. #endif
  1699.  
  1700.   /* Now store any partially-in-registers parm.
  1701.      This is the last place a block-move can happen.  */
  1702.   if (reg_parm_seen)
  1703.     for (i = 0; i < num_actuals; i++)
  1704.       if (args[i].partial != 0 && ! args[i].pass_on_stack)
  1705.     store_one_arg (&args[i], argblock, may_be_alloca,
  1706.                args_size.var != 0, fndecl, reg_parm_stack_space);
  1707.  
  1708. #ifndef PUSH_ARGS_REVERSED
  1709. #ifdef STACK_BOUNDARY
  1710.   /* If we pushed args in forward order, perform stack alignment
  1711.      after pushing the last arg.  */
  1712.   if (argblock == 0)
  1713.     anti_adjust_stack (GEN_INT (args_size.constant
  1714.                 - original_args_size.constant));
  1715. #endif
  1716. #endif
  1717.  
  1718.   /* If register arguments require space on the stack and stack space
  1719.      was not preallocated, allocate stack space here for arguments
  1720.      passed in registers.  */
  1721. #if ! defined(ACCUMULATE_OUTGOING_ARGS) && defined(OUTGOING_REG_PARM_STACK_SPACE)
  1722.   if (must_preallocate == 0 && reg_parm_stack_space > 0)
  1723.     anti_adjust_stack (GEN_INT (reg_parm_stack_space));
  1724. #endif
  1725.  
  1726.   /* Pass the function the address in which to return a structure value.  */
  1727.   if (structure_value_addr && ! structure_value_addr_parm)
  1728.     {
  1729.       emit_move_insn (struct_value_rtx,
  1730.               force_reg (Pmode,
  1731.                  force_operand (structure_value_addr,
  1732.                         NULL_RTX)));
  1733.       if (GET_CODE (struct_value_rtx) == REG)
  1734.     {
  1735.       push_to_sequence (use_insns);
  1736.       emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));
  1737.       use_insns = get_insns ();
  1738.       end_sequence ();
  1739.     }
  1740.     }
  1741.  
  1742.   /* Now do the register loads required for any wholly-register parms or any
  1743.      parms which are passed both on the stack and in a register.  Their
  1744.      expressions were already evaluated. 
  1745.  
  1746.      Mark all register-parms as living through the call, putting these USE
  1747.      insns in a list headed by USE_INSNS.  */
  1748.  
  1749.   for (i = 0; i < num_actuals; i++)
  1750.     {
  1751.       rtx list = args[i].reg;
  1752.       int partial = args[i].partial;
  1753.  
  1754.       while (list)
  1755.     {
  1756.       rtx reg;
  1757.       int nregs;
  1758.  
  1759.       /* Process each register that needs to get this arg.  */
  1760.       if (GET_CODE (list) == EXPR_LIST)
  1761.         reg = XEXP (list, 0), list = XEXP (list, 1);
  1762.       else
  1763.         reg = list, list = 0;
  1764.  
  1765.       /* Set to non-zero if must move a word at a time, even if just one
  1766.          word (e.g, partial == 1 && mode == DFmode).  Set to zero if
  1767.          we just use a normal move insn.  */
  1768.       nregs = (partial ? partial
  1769.            : (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
  1770.               ? ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
  1771.               + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
  1772.               : 0));
  1773.  
  1774.       /* If simple case, just do move.  If normal partial, store_one_arg
  1775.          has already loaded the register for us.  In all other cases,
  1776.          load the register(s) from memory.  */
  1777.  
  1778.       if (nregs == 0)
  1779.         emit_move_insn (reg, args[i].value);
  1780.  
  1781. #ifdef STRICT_ALIGNMENT
  1782.       /* If we have pre-computed the values to put in the registers in
  1783.          the case of non-aligned structures, copy them in now.  */
  1784.  
  1785.       else if (args[i].n_aligned_regs != 0)
  1786.         for (j = 0; j < args[i].n_aligned_regs; j++)
  1787.           emit_move_insn (gen_rtx (REG, word_mode, REGNO (reg) + j),
  1788.                   args[i].aligned_regs[j]);
  1789. #endif
  1790.  
  1791.       else if (args[i].partial == 0 || args[i].pass_on_stack)
  1792.         move_block_to_reg (REGNO (reg),
  1793.                    validize_mem (args[i].value), nregs,
  1794.                    args[i].mode);
  1795.     
  1796. #ifdef DUP_REG_ARG_LOAD
  1797.       DUP_REG_ARG_LOAD (name, nregs, reg, args[i].value, args[i].mode);
  1798. #endif
  1799.  
  1800.       push_to_sequence (use_insns);
  1801.       if (nregs == 0)
  1802.         emit_insn (gen_rtx (USE, VOIDmode, reg));
  1803.       else
  1804.         use_regs (REGNO (reg), nregs);
  1805. #ifdef USE_DUP_REG_ARG_LOAD
  1806.       USE_DUP_REG_ARG_LOAD (name, nregs, reg, args[i].mode);
  1807. #endif
  1808.       use_insns = get_insns ();
  1809.       end_sequence ();
  1810.  
  1811.       /* PARTIAL referred only to the first register, so clear it for the
  1812.          next time.  */
  1813.       partial = 0;
  1814.     }
  1815.     }
  1816.  
  1817.   /* Perform postincrements before actually calling the function.  */
  1818.   emit_queue ();
  1819.  
  1820.   /* All arguments and registers used for the call must be set up by now!  */
  1821.  
  1822.   funexp = prepare_call_address (funexp, fndecl, &use_insns);
  1823.  
  1824.   /* Generate the actual call instruction.  */
  1825.   emit_call_1 (funexp, funtype, args_size.constant, struct_value_size,
  1826.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  1827.            valreg, old_inhibit_defer_pop, use_insns, is_const);
  1828.  
  1829.   /* If call is cse'able, make appropriate pair of reg-notes around it.
  1830.      Test valreg so we don't crash; may safely ignore `const'
  1831.      if return type is void.  */
  1832.   if (is_const && valreg != 0)
  1833.     {
  1834.       rtx note = 0;
  1835.       rtx temp = gen_reg_rtx (GET_MODE (valreg));
  1836.       rtx insns;
  1837.  
  1838.       /* Construct an "equal form" for the value which mentions all the
  1839.      arguments in order as well as the function name.  */
  1840. #ifdef PUSH_ARGS_REVERSED
  1841.       for (i = 0; i < num_actuals; i++)
  1842.     note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
  1843. #else
  1844.       for (i = num_actuals - 1; i >= 0; i--)
  1845.     note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
  1846. #endif
  1847.       note = gen_rtx (EXPR_LIST, VOIDmode, funexp, note);
  1848.  
  1849.       insns = get_insns ();
  1850.       end_sequence ();
  1851.  
  1852.       emit_libcall_block (insns, temp, valreg, note);
  1853.  
  1854.       valreg = temp;
  1855.     }
  1856.  
  1857.   /* For calls to `setjmp', etc., inform flow.c it should complain
  1858.      if nonvolatile values are live.  */
  1859.  
  1860.   if (returns_twice)
  1861.     {
  1862.       emit_note (name, NOTE_INSN_SETJMP);
  1863.       current_function_calls_setjmp = 1;
  1864.     }
  1865.  
  1866.   if (is_longjmp)
  1867.     current_function_calls_longjmp = 1;
  1868.  
  1869.   /* Notice functions that cannot return.
  1870.      If optimizing, insns emitted below will be dead.
  1871.      If not optimizing, they will exist, which is useful
  1872.      if the user uses the `return' command in the debugger.  */
  1873.  
  1874.   if (is_volatile || is_longjmp)
  1875.     emit_barrier ();
  1876.  
  1877.   /* If value type not void, return an rtx for the value.  */
  1878.  
  1879.   /* If there are cleanups to be called, don't use a hard reg as target.  */
  1880.   if (cleanups_this_call != old_cleanups
  1881.       && target && REG_P (target)
  1882.       && REGNO (target) < FIRST_PSEUDO_REGISTER)
  1883.     target = 0;
  1884.  
  1885.   if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
  1886.       || ignore)
  1887.     {
  1888.       target = const0_rtx;
  1889.     }
  1890.   else if (structure_value_addr)
  1891.     {
  1892.       if (target == 0 || GET_CODE (target) != MEM)
  1893.     {
  1894.       target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  1895.                 memory_address (TYPE_MODE (TREE_TYPE (exp)),
  1896.                         structure_value_addr));
  1897.       MEM_IN_STRUCT_P (target)
  1898.         = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
  1899.            || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
  1900.            || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
  1901.            || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE);
  1902.     }
  1903.     }
  1904.   else if (pcc_struct_value)
  1905.     {
  1906.       if (target == 0)
  1907.     {
  1908.       /* We used leave the value in the location that it is
  1909.          returned in, but that causes problems if it is used more
  1910.          than once in one expression.  Rather than trying to track
  1911.          when a copy is required, we always copy when TARGET is
  1912.          not specified.  This calling sequence is only used on
  1913.          a few machines and TARGET is usually nonzero.  */
  1914.       if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
  1915.         {
  1916.           target = assign_stack_temp (BLKmode,
  1917.                       int_size_in_bytes (TREE_TYPE (exp)),
  1918.                       0);
  1919.  
  1920.           /* Save this temp slot around the pop below.  */
  1921.           preserve_temp_slots (target);
  1922.         }
  1923.       else
  1924.         target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
  1925.     }
  1926.  
  1927.       if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
  1928.     emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  1929.                      copy_to_reg (valreg)));
  1930.       else
  1931.     emit_block_move (target, gen_rtx (MEM, BLKmode, copy_to_reg (valreg)),
  1932.              expr_size (exp),
  1933.              TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  1934.     }
  1935.   else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp))
  1936.        && GET_MODE (target) == GET_MODE (valreg))
  1937.     /* TARGET and VALREG cannot be equal at this point because the latter
  1938.        would not have REG_FUNCTION_VALUE_P true, while the former would if
  1939.        it were referring to the same register.
  1940.  
  1941.        If they refer to the same register, this move will be a no-op, except
  1942.        when function inlining is being done.  */
  1943.     emit_move_insn (target, valreg);
  1944.   else
  1945.     target = copy_to_reg (valreg);
  1946.  
  1947. #ifdef PROMOTE_FUNCTION_RETURN
  1948.   /* If we promoted this return value, make the proper SUBREG.  TARGET
  1949.      might be const0_rtx here, so be careful.  */
  1950.   if (GET_CODE (target) == REG
  1951.       && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
  1952.     {
  1953.       enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
  1954.       int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  1955.  
  1956.       if (TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
  1957.       || TREE_CODE (TREE_TYPE (exp)) == ENUMERAL_TYPE
  1958.       || TREE_CODE (TREE_TYPE (exp)) == BOOLEAN_TYPE
  1959.       || TREE_CODE (TREE_TYPE (exp)) == CHAR_TYPE
  1960.       || TREE_CODE (TREE_TYPE (exp)) == REAL_TYPE
  1961.       || TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE
  1962.       || TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE)
  1963.     {
  1964.       PROMOTE_MODE (mode, unsignedp, TREE_TYPE (exp));
  1965.     }
  1966.  
  1967.       /* If we didn't promote as expected, something is wrong.  */
  1968.       if (mode != GET_MODE (target))
  1969.     abort ();
  1970.  
  1971.       target = gen_rtx (SUBREG, TYPE_MODE (TREE_TYPE (exp)), target, 0);
  1972.       SUBREG_PROMOTED_VAR_P (target) = 1;
  1973.       SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp;
  1974.     }
  1975. #endif
  1976.  
  1977.   /* Perform all cleanups needed for the arguments of this call
  1978.      (i.e. destructors in C++).  */
  1979.   expand_cleanups_to (old_cleanups);
  1980.  
  1981.   /* If size of args is variable or this was a constructor call for a stack
  1982.      argument, restore saved stack-pointer value.  */
  1983.  
  1984.   if (old_stack_level)
  1985.     {
  1986.       emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
  1987.       pending_stack_adjust = old_pending_adj;
  1988. #ifdef ACCUMULATE_OUTGOING_ARGS
  1989.       stack_arg_under_construction = old_stack_arg_under_construction;
  1990.       highest_outgoing_arg_in_use = initial_highest_arg_in_use;
  1991.       stack_usage_map = initial_stack_usage_map;
  1992. #endif
  1993.     }
  1994. #ifdef ACCUMULATE_OUTGOING_ARGS
  1995.   else
  1996.     {
  1997. #ifdef REG_PARM_STACK_SPACE
  1998.       if (save_area)
  1999.     {
  2000.       enum machine_mode save_mode = GET_MODE (save_area);
  2001.       rtx stack_area
  2002.         = gen_rtx (MEM, save_mode,
  2003.                memory_address (save_mode,
  2004. #ifdef ARGS_GROW_DOWNWARD
  2005.                        plus_constant (argblock, - high_to_save)
  2006. #else
  2007.                        plus_constant (argblock, low_to_save)
  2008. #endif
  2009.                        ));
  2010.  
  2011.       if (save_mode != BLKmode)
  2012.         emit_move_insn (stack_area, save_area);
  2013.       else
  2014.         emit_block_move (stack_area, validize_mem (save_area),
  2015.                  GEN_INT (high_to_save - low_to_save + 1),
  2016.                  PARM_BOUNDARY / BITS_PER_UNIT);
  2017.     }
  2018. #endif
  2019.       
  2020.       /* If we saved any argument areas, restore them.  */
  2021.       for (i = 0; i < num_actuals; i++)
  2022.     if (args[i].save_area)
  2023.       {
  2024.         enum machine_mode save_mode = GET_MODE (args[i].save_area);
  2025.         rtx stack_area
  2026.           = gen_rtx (MEM, save_mode,
  2027.              memory_address (save_mode,
  2028.                      XEXP (args[i].stack_slot, 0)));
  2029.  
  2030.         if (save_mode != BLKmode)
  2031.           emit_move_insn (stack_area, args[i].save_area);
  2032.         else
  2033.           emit_block_move (stack_area, validize_mem (args[i].save_area),
  2034.                    GEN_INT (args[i].size.constant),
  2035.                    PARM_BOUNDARY / BITS_PER_UNIT);
  2036.       }
  2037.  
  2038.       highest_outgoing_arg_in_use = initial_highest_arg_in_use;
  2039.       stack_usage_map = initial_stack_usage_map;
  2040.     }
  2041. #endif
  2042.  
  2043.   /* If this was alloca, record the new stack level for nonlocal gotos.  
  2044.      Check for the handler slots since we might not have a save area
  2045.      for non-local gotos. */
  2046.  
  2047.   if (may_be_alloca && nonlocal_goto_handler_slot != 0)
  2048.     emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
  2049.  
  2050.   pop_temp_slots ();
  2051.  
  2052.   return target;
  2053. }
  2054.  
  2055. /* Output a library call to function FUN (a SYMBOL_REF rtx)
  2056.    (emitting the queue unless NO_QUEUE is nonzero),
  2057.    for a value of mode OUTMODE,
  2058.    with NARGS different arguments, passed as alternating rtx values
  2059.    and machine_modes to convert them to.
  2060.    The rtx values should have been passed through protect_from_queue already.
  2061.  
  2062.    NO_QUEUE will be true if and only if the library call is a `const' call
  2063.    which will be enclosed in REG_LIBCALL/REG_RETVAL notes; it is equivalent
  2064.    to the variable is_const in expand_call.
  2065.  
  2066.    NO_QUEUE must be true for const calls, because if it isn't, then
  2067.    any pending increment will be emitted between REG_LIBCALL/REG_RETVAL notes,
  2068.    and will be lost if the libcall sequence is optimized away.
  2069.  
  2070.    NO_QUEUE must be false for non-const calls, because if it isn't, the
  2071.    call insn will have its CONST_CALL_P bit set, and it will be incorrectly
  2072.    optimized.  For instance, the instruction scheduler may incorrectly
  2073.    move memory references across the non-const call.  */
  2074.  
  2075. void
  2076. emit_library_call (va_alist)
  2077.      va_dcl
  2078. {
  2079.   va_list p;
  2080.   /* Total size in bytes of all the stack-parms scanned so far.  */
  2081.   struct args_size args_size;
  2082.   /* Size of arguments before any adjustments (such as rounding).  */
  2083.   struct args_size original_args_size;
  2084.   register int argnum;
  2085.   enum machine_mode outmode;
  2086.   int nargs;
  2087.   rtx fun;
  2088.   rtx orgfun;
  2089.   tree name;
  2090.   int inc;
  2091.   int count;
  2092.   rtx argblock = 0;
  2093.   CUMULATIVE_ARGS args_so_far;
  2094.   struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
  2095.            struct args_size offset; struct args_size size; };
  2096.   struct arg *argvec;
  2097.   int old_inhibit_defer_pop = inhibit_defer_pop;
  2098.   int no_queue = 0;
  2099.   rtx use_insns;
  2100.   /* library calls are never indirect calls.  */
  2101.   int current_call_is_indirect = 0;
  2102.  
  2103.   va_start (p);
  2104.   orgfun = fun = va_arg (p, rtx);
  2105.   no_queue = va_arg (p, int);
  2106.   outmode = va_arg (p, enum machine_mode);
  2107.   nargs = va_arg (p, int);
  2108.  
  2109.   name = get_identifier (XSTR (orgfun, 0));
  2110.  
  2111.   /* Copy all the libcall-arguments out of the varargs data
  2112.      and into a vector ARGVEC.
  2113.  
  2114.      Compute how to pass each argument.  We only support a very small subset
  2115.      of the full argument passing conventions to limit complexity here since
  2116.      library functions shouldn't have many args.  */
  2117.  
  2118.   argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  2119.  
  2120.   INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun);
  2121.  
  2122.   args_size.constant = 0;
  2123.   args_size.var = 0;
  2124.  
  2125.   push_temp_slots ();
  2126.  
  2127.   for (count = 0; count < nargs; count++)
  2128.     {
  2129.       rtx val = va_arg (p, rtx);
  2130.       enum machine_mode mode = va_arg (p, enum machine_mode);
  2131.  
  2132.       /* We cannot convert the arg value to the mode the library wants here;
  2133.      must do it earlier where we know the signedness of the arg.  */
  2134.       if (mode == BLKmode
  2135.       || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
  2136.     abort ();
  2137.  
  2138.       /* On some machines, there's no way to pass a float to a library fcn.
  2139.      Pass it as a double instead.  */
  2140. #ifdef LIBGCC_NEEDS_DOUBLE
  2141.       if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
  2142.     val = convert_to_mode (DFmode, val, 0), mode = DFmode;
  2143. #endif
  2144.  
  2145.       /* There's no need to call protect_from_queue, because
  2146.      either emit_move_insn or emit_push_insn will do that.  */
  2147.  
  2148.       /* Make sure it is a reasonable operand for a move or push insn.  */
  2149.       if (GET_CODE (val) != REG && GET_CODE (val) != MEM
  2150.       && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
  2151.     val = force_operand (val, NULL_RTX);
  2152.  
  2153. #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
  2154.       if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
  2155.     {
  2156.       /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can
  2157.          be viewed as just an efficiency improvement.  */
  2158.       rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
  2159.       emit_move_insn (slot, val);
  2160.       val = XEXP (slot, 0);
  2161.       mode = Pmode;
  2162.     }
  2163. #endif
  2164.  
  2165.       argvec[count].value = val;
  2166.       argvec[count].mode = mode;
  2167.  
  2168.       argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
  2169.       if (argvec[count].reg && GET_CODE (argvec[count].reg) == EXPR_LIST)
  2170.     abort ();
  2171. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  2172.       argvec[count].partial
  2173.     = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
  2174. #else
  2175.       argvec[count].partial = 0;
  2176. #endif
  2177.  
  2178.       locate_and_pad_parm (mode, NULL_TREE,
  2179.                argvec[count].reg && argvec[count].partial == 0,
  2180.                NULL_TREE, &args_size, &argvec[count].offset,
  2181.                &argvec[count].size);
  2182.  
  2183.       if (argvec[count].size.var)
  2184.     abort ();
  2185.  
  2186. #ifndef REG_PARM_STACK_SPACE
  2187.       if (argvec[count].partial)
  2188.     argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
  2189. #endif
  2190.  
  2191.       if (argvec[count].reg == 0 || argvec[count].partial != 0
  2192. #ifdef REG_PARM_STACK_SPACE
  2193.       || 1
  2194. #endif
  2195.       )
  2196.     args_size.constant += argvec[count].size.constant;
  2197.  
  2198. #ifdef ACCUMULATE_OUTGOING_ARGS
  2199.       /* If this arg is actually passed on the stack, it might be
  2200.      clobbering something we already put there (this library call might
  2201.      be inside the evaluation of an argument to a function whose call
  2202.      requires the stack).  This will only occur when the library call
  2203.      has sufficient args to run out of argument registers.  Abort in
  2204.      this case; if this ever occurs, code must be added to save and
  2205.      restore the arg slot.  */
  2206.  
  2207.       if (argvec[count].reg == 0 || argvec[count].partial != 0)
  2208.     abort ();
  2209. #endif
  2210.  
  2211.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  2212.     }
  2213.   va_end (p);
  2214.  
  2215.   /* If this machine requires an external definition for library
  2216.      functions, write one out.  */
  2217.   assemble_external_libcall (fun);
  2218.  
  2219.   original_args_size = args_size;
  2220. #ifdef STACK_BOUNDARY
  2221.   args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
  2222.              / STACK_BYTES) * STACK_BYTES);
  2223. #endif
  2224.  
  2225. #ifdef REG_PARM_STACK_SPACE
  2226.   args_size.constant = MAX (args_size.constant,
  2227.                 REG_PARM_STACK_SPACE (NULL_TREE));
  2228. #ifndef OUTGOING_REG_PARM_STACK_SPACE
  2229.   args_size.constant -= REG_PARM_STACK_SPACE (NULL_TREE);
  2230. #endif
  2231. #endif
  2232.  
  2233. #ifdef ACCUMULATE_OUTGOING_ARGS
  2234.   if (args_size.constant > current_function_outgoing_args_size)
  2235.     current_function_outgoing_args_size = args_size.constant;
  2236.   args_size.constant = 0;
  2237. #endif
  2238.  
  2239. #ifndef PUSH_ROUNDING
  2240.   argblock = push_block (GEN_INT (args_size.constant), 0, 0);
  2241. #endif
  2242.  
  2243. #ifdef PUSH_ARGS_REVERSED
  2244. #ifdef STACK_BOUNDARY
  2245.   /* If we push args individually in reverse order, perform stack alignment
  2246.      before the first push (the last arg).  */
  2247.   if (argblock == 0)
  2248.     anti_adjust_stack (GEN_INT (args_size.constant
  2249.                 - original_args_size.constant));
  2250. #endif
  2251. #endif
  2252.  
  2253. #ifdef PUSH_ARGS_REVERSED
  2254.   inc = -1;
  2255.   argnum = nargs - 1;
  2256. #else
  2257.   inc = 1;
  2258.   argnum = 0;
  2259. #endif
  2260.  
  2261.   /* Push the args that need to be pushed.  */
  2262.  
  2263.   for (count = 0; count < nargs; count++, argnum += inc)
  2264.     {
  2265.       register enum machine_mode mode = argvec[argnum].mode;
  2266.       register rtx val = argvec[argnum].value;
  2267.       rtx reg = argvec[argnum].reg;
  2268.       int partial = argvec[argnum].partial;
  2269.  
  2270.       if (! (reg != 0 && partial == 0))
  2271.     emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
  2272.             argblock, GEN_INT (argvec[count].offset.constant));
  2273.       NO_DEFER_POP;
  2274.     }
  2275.  
  2276. #ifndef PUSH_ARGS_REVERSED
  2277. #ifdef STACK_BOUNDARY
  2278.   /* If we pushed args in forward order, perform stack alignment
  2279.      after pushing the last arg.  */
  2280.   if (argblock == 0)
  2281.     anti_adjust_stack (GEN_INT (args_size.constant
  2282.                 - original_args_size.constant));
  2283. #endif
  2284. #endif
  2285.  
  2286. #ifdef PUSH_ARGS_REVERSED
  2287.   argnum = nargs - 1;
  2288. #else
  2289.   argnum = 0;
  2290. #endif
  2291.  
  2292.   /* Now load any reg parms into their regs.  */
  2293.  
  2294.   for (count = 0; count < nargs; count++, argnum += inc)
  2295.     {
  2296.       register enum machine_mode mode = argvec[argnum].mode;
  2297.       register rtx val = argvec[argnum].value;
  2298.       rtx reg = argvec[argnum].reg;
  2299.       int partial = argvec[argnum].partial;
  2300.  
  2301.       if (reg != 0 && partial == 0)
  2302.     {
  2303.       emit_move_insn (reg, val);
  2304. #ifdef DUP_REG_ARG_LOAD
  2305.       DUP_REG_ARG_LOAD (name, 0, reg, val, mode);
  2306. #endif
  2307.     }
  2308.  
  2309.       NO_DEFER_POP;
  2310.     }
  2311.  
  2312.   /* For version 1.37, try deleting this entirely.  */
  2313.   if (! no_queue)
  2314.     emit_queue ();
  2315.  
  2316.   /* Any regs containing parms remain in use through the call.  */
  2317.   start_sequence ();
  2318.   for (count = 0; count < nargs; count++)
  2319.     if (argvec[count].reg != 0)
  2320.       {
  2321.     emit_insn (gen_rtx (USE, VOIDmode, argvec[count].reg));
  2322. #ifdef USE_DUP_REG_ARG_LOAD
  2323.     USE_DUP_REG_ARG_LOAD (name, 0, argvec[count].reg, argvec[count].mode);
  2324. #endif
  2325.       }
  2326.  
  2327.   use_insns = get_insns ();
  2328.   end_sequence ();
  2329.  
  2330.   fun = prepare_call_address (fun, NULL_TREE, &use_insns);
  2331.  
  2332.   /* Don't allow popping to be deferred, since then
  2333.      cse'ing of library calls could delete a call and leave the pop.  */
  2334.   NO_DEFER_POP;
  2335.  
  2336.   /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
  2337.      will set inhibit_defer_pop to that value.  */
  2338.  
  2339.   emit_call_1 (fun, name, args_size.constant, 0,
  2340.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  2341.            outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
  2342.            old_inhibit_defer_pop + 1, use_insns, no_queue);
  2343.  
  2344.   pop_temp_slots ();
  2345.  
  2346.   /* Now restore inhibit_defer_pop to its actual original value.  */
  2347.   OK_DEFER_POP;
  2348. }
  2349.  
  2350. /* Like emit_library_call except that an extra argument, VALUE,
  2351.    comes second and says where to store the result.
  2352.    (If VALUE is zero, this function chooses a convenient way
  2353.    to return the value.
  2354.  
  2355.    This function returns an rtx for where the value is to be found.
  2356.    If VALUE is nonzero, VALUE is returned.  */
  2357.  
  2358. rtx
  2359. emit_library_call_value (va_alist)
  2360.      va_dcl
  2361. {
  2362.   va_list p;
  2363.   /* Total size in bytes of all the stack-parms scanned so far.  */
  2364.   struct args_size args_size;
  2365.   /* Size of arguments before any adjustments (such as rounding).  */
  2366.   struct args_size original_args_size;
  2367.   register int argnum;
  2368.   enum machine_mode outmode;
  2369.   int nargs;
  2370.   rtx fun;
  2371.   rtx orgfun;
  2372.   int inc;
  2373.   int count;
  2374.   rtx argblock = 0;
  2375.   CUMULATIVE_ARGS args_so_far;
  2376.   struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
  2377.            struct args_size offset; struct args_size size; };
  2378.   struct arg *argvec;
  2379.   int old_inhibit_defer_pop = inhibit_defer_pop;
  2380.   int no_queue = 0;
  2381.   rtx use_insns;
  2382.   rtx value;
  2383.   rtx mem_value = 0;
  2384.   int pcc_struct_value = 0;
  2385.   int struct_value_size = 0;
  2386.   /* library calls are never indirect calls.  */
  2387.   int current_call_is_indirect = 0;
  2388.  
  2389.   va_start (p);
  2390.   orgfun = fun = va_arg (p, rtx);
  2391.   value = va_arg (p, rtx);
  2392.   no_queue = va_arg (p, int);
  2393.   outmode = va_arg (p, enum machine_mode);
  2394.   nargs = va_arg (p, int);
  2395.  
  2396.   /* If this kind of value comes back in memory,
  2397.      decide where in memory it should come back.  */
  2398.   if (aggregate_value_p (type_for_mode (outmode, 0)))
  2399.     {
  2400. #ifdef PCC_STATIC_STRUCT_RETURN
  2401.       rtx pointer_reg
  2402.     = hard_function_value (build_pointer_type (type_for_mode (outmode, 0)),
  2403.                    0);
  2404.       mem_value = gen_rtx (MEM, outmode, pointer_reg);
  2405.       pcc_struct_value = 1;
  2406.       if (value == 0)
  2407.     value = gen_reg_rtx (outmode);
  2408. #else /* not PCC_STATIC_STRUCT_RETURN */
  2409.       struct_value_size = GET_MODE_SIZE (outmode);
  2410.       if (value != 0 && GET_CODE (value) == MEM)
  2411.     mem_value = value;
  2412.       else
  2413.     mem_value = assign_stack_temp (outmode, GET_MODE_SIZE (outmode), 0);
  2414. #endif
  2415.     }
  2416.  
  2417.   /* ??? Unfinished: must pass the memory address as an argument.  */
  2418.  
  2419.   /* Copy all the libcall-arguments out of the varargs data
  2420.      and into a vector ARGVEC.
  2421.  
  2422.      Compute how to pass each argument.  We only support a very small subset
  2423.      of the full argument passing conventions to limit complexity here since
  2424.      library functions shouldn't have many args.  */
  2425.  
  2426.   argvec = (struct arg *) alloca ((nargs + 1) * sizeof (struct arg));
  2427.  
  2428.   INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun);
  2429.  
  2430.   args_size.constant = 0;
  2431.   args_size.var = 0;
  2432.  
  2433.   count = 0;
  2434.  
  2435.   push_temp_slots ();
  2436.  
  2437.   /* If there's a structure value address to be passed,
  2438.      either pass it in the special place, or pass it as an extra argument.  */
  2439.   if (mem_value && struct_value_rtx == 0 && ! pcc_struct_value)
  2440.     {
  2441.       rtx addr = XEXP (mem_value, 0);
  2442.       nargs++;
  2443.  
  2444.       /* Make sure it is a reasonable operand for a move or push insn.  */
  2445.       if (GET_CODE (addr) != REG && GET_CODE (addr) != MEM
  2446.       && ! (CONSTANT_P (addr) && LEGITIMATE_CONSTANT_P (addr)))
  2447.     addr = force_operand (addr, NULL_RTX);
  2448.  
  2449.       argvec[count].value = addr;
  2450.       argvec[count].mode = Pmode;
  2451.       argvec[count].partial = 0;
  2452.  
  2453.       argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1);
  2454. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  2455.       if (FUNCTION_ARG_PARTIAL_NREGS (args_so_far, Pmode, NULL_TREE, 1))
  2456.     abort ();
  2457. #endif
  2458.  
  2459.       locate_and_pad_parm (Pmode, NULL_TREE,
  2460.                argvec[count].reg && argvec[count].partial == 0,
  2461.                NULL_TREE, &args_size, &argvec[count].offset,
  2462.                &argvec[count].size);
  2463.  
  2464.  
  2465.       if (argvec[count].reg == 0 || argvec[count].partial != 0
  2466. #ifdef REG_PARM_STACK_SPACE
  2467.       || 1
  2468. #endif
  2469.       )
  2470.     args_size.constant += argvec[count].size.constant;
  2471.  
  2472.       FUNCTION_ARG_ADVANCE (args_so_far, Pmode, (tree)0, 1);
  2473.  
  2474.       count++;
  2475.     }
  2476.  
  2477.   for (; count < nargs; count++)
  2478.     {
  2479.       rtx val = va_arg (p, rtx);
  2480.       enum machine_mode mode = va_arg (p, enum machine_mode);
  2481.  
  2482.       /* We cannot convert the arg value to the mode the library wants here;
  2483.      must do it earlier where we know the signedness of the arg.  */
  2484.       if (mode == BLKmode
  2485.       || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
  2486.     abort ();
  2487.  
  2488.       /* On some machines, there's no way to pass a float to a library fcn.
  2489.      Pass it as a double instead.  */
  2490. #ifdef LIBGCC_NEEDS_DOUBLE
  2491.       if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
  2492.     val = convert_to_mode (DFmode, val, 0), mode = DFmode;
  2493. #endif
  2494.  
  2495.       /* There's no need to call protect_from_queue, because
  2496.      either emit_move_insn or emit_push_insn will do that.  */
  2497.  
  2498.       /* Make sure it is a reasonable operand for a move or push insn.  */
  2499.       if (GET_CODE (val) != REG && GET_CODE (val) != MEM
  2500.       && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
  2501.     val = force_operand (val, NULL_RTX);
  2502.  
  2503. #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
  2504.       if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
  2505.     {
  2506.       /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can
  2507.          be viewed as just an efficiency improvement.  */
  2508.       rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
  2509.       emit_move_insn (slot, val);
  2510.       val = XEXP (slot, 0);
  2511.       mode = Pmode;
  2512.     }
  2513. #endif
  2514.  
  2515.       argvec[count].value = val;
  2516.       argvec[count].mode = mode;
  2517.  
  2518.       argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
  2519.       if (argvec[count].reg && GET_CODE (argvec[count].reg) == EXPR_LIST)
  2520.     abort ();
  2521. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  2522.       argvec[count].partial
  2523.     = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
  2524. #else
  2525.       argvec[count].partial = 0;
  2526. #endif
  2527.  
  2528.       locate_and_pad_parm (mode, NULL_TREE,
  2529.                argvec[count].reg && argvec[count].partial == 0,
  2530.                NULL_TREE, &args_size, &argvec[count].offset,
  2531.                &argvec[count].size);
  2532.  
  2533.       if (argvec[count].size.var)
  2534.     abort ();
  2535.  
  2536. #ifndef REG_PARM_STACK_SPACE
  2537.       if (argvec[count].partial)
  2538.     argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
  2539. #endif
  2540.  
  2541.       if (argvec[count].reg == 0 || argvec[count].partial != 0
  2542. #ifdef REG_PARM_STACK_SPACE
  2543.       || 1
  2544. #endif
  2545.       )
  2546.     args_size.constant += argvec[count].size.constant;
  2547.  
  2548. #ifdef ACCUMULATE_OUTGOING_ARGS
  2549.       /* If this arg is actually passed on the stack, it might be
  2550.      clobbering something we already put there (this library call might
  2551.      be inside the evaluation of an argument to a function whose call
  2552.      requires the stack).  This will only occur when the library call
  2553.      has sufficient args to run out of argument registers.  Abort in
  2554.      this case; if this ever occurs, code must be added to save and
  2555.      restore the arg slot.  */
  2556.  
  2557.       if (argvec[count].reg == 0 || argvec[count].partial != 0)
  2558.     abort ();
  2559. #endif
  2560.  
  2561.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  2562.     }
  2563.   va_end (p);
  2564.  
  2565.   /* If this machine requires an external definition for library
  2566.      functions, write one out.  */
  2567.   assemble_external_libcall (fun);
  2568.  
  2569.   original_args_size = args_size;
  2570. #ifdef STACK_BOUNDARY
  2571.   args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
  2572.              / STACK_BYTES) * STACK_BYTES);
  2573. #endif
  2574.  
  2575. #ifdef REG_PARM_STACK_SPACE
  2576.   args_size.constant = MAX (args_size.constant,
  2577.                 REG_PARM_STACK_SPACE (NULL_TREE));
  2578. #ifndef OUTGOING_REG_PARM_STACK_SPACE
  2579.   args_size.constant -= REG_PARM_STACK_SPACE (NULL_TREE);
  2580. #endif
  2581. #endif
  2582.  
  2583. #ifdef ACCUMULATE_OUTGOING_ARGS
  2584.   if (args_size.constant > current_function_outgoing_args_size)
  2585.     current_function_outgoing_args_size = args_size.constant;
  2586.   args_size.constant = 0;
  2587. #endif
  2588.  
  2589. #ifndef PUSH_ROUNDING
  2590.   argblock = push_block (GEN_INT (args_size.constant), 0, 0);
  2591. #endif
  2592.  
  2593. #ifdef PUSH_ARGS_REVERSED
  2594. #ifdef STACK_BOUNDARY
  2595.   /* If we push args individually in reverse order, perform stack alignment
  2596.      before the first push (the last arg).  */
  2597.   if (argblock == 0)
  2598.     anti_adjust_stack (GEN_INT (args_size.constant
  2599.                 - original_args_size.constant));
  2600. #endif
  2601. #endif
  2602.  
  2603. #ifdef PUSH_ARGS_REVERSED
  2604.   inc = -1;
  2605.   argnum = nargs - 1;
  2606. #else
  2607.   inc = 1;
  2608.   argnum = 0;
  2609. #endif
  2610.  
  2611.   /* Push the args that need to be pushed.  */
  2612.  
  2613.   for (count = 0; count < nargs; count++, argnum += inc)
  2614.     {
  2615.       register enum machine_mode mode = argvec[argnum].mode;
  2616.       register rtx val = argvec[argnum].value;
  2617.       rtx reg = argvec[argnum].reg;
  2618.       int partial = argvec[argnum].partial;
  2619.  
  2620.       if (! (reg != 0 && partial == 0))
  2621.     emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
  2622.             argblock, GEN_INT (argvec[count].offset.constant));
  2623.       NO_DEFER_POP;
  2624.     }
  2625.  
  2626. #ifndef PUSH_ARGS_REVERSED
  2627. #ifdef STACK_BOUNDARY
  2628.   /* If we pushed args in forward order, perform stack alignment
  2629.      after pushing the last arg.  */
  2630.   if (argblock == 0)
  2631.     anti_adjust_stack (GEN_INT (args_size.constant
  2632.                 - original_args_size.constant));
  2633. #endif
  2634. #endif
  2635.  
  2636. #ifdef PUSH_ARGS_REVERSED
  2637.   argnum = nargs - 1;
  2638. #else
  2639.   argnum = 0;
  2640. #endif
  2641.  
  2642.   /* Now load any reg parms into their regs.  */
  2643.  
  2644.   for (count = 0; count < nargs; count++, argnum += inc)
  2645.     {
  2646.       register enum machine_mode mode = argvec[argnum].mode;
  2647.       register rtx val = argvec[argnum].value;
  2648.       rtx reg = argvec[argnum].reg;
  2649.       int partial = argvec[argnum].partial;
  2650.  
  2651.       if (reg != 0 && partial == 0)
  2652.     emit_move_insn (reg, val);
  2653.       NO_DEFER_POP;
  2654.     }
  2655.  
  2656. #if 0
  2657.   /* For version 1.37, try deleting this entirely.  */
  2658.   if (! no_queue)
  2659.     emit_queue ();
  2660. #endif
  2661.  
  2662.   /* Any regs containing parms remain in use through the call.  */
  2663.   start_sequence ();
  2664.   for (count = 0; count < nargs; count++)
  2665.     if (argvec[count].reg != 0)
  2666.       emit_insn (gen_rtx (USE, VOIDmode, argvec[count].reg));
  2667.  
  2668.   use_insns = get_insns ();
  2669.   end_sequence ();
  2670.  
  2671.   /* Pass the function the address in which to return a structure value.  */
  2672.   if (mem_value != 0 && struct_value_rtx != 0 && ! pcc_struct_value)
  2673.     {
  2674.       emit_move_insn (struct_value_rtx,
  2675.               force_reg (Pmode,
  2676.                  force_operand (XEXP (mem_value, 0),
  2677.                         NULL_RTX)));
  2678.       if (GET_CODE (struct_value_rtx) == REG)
  2679.     {
  2680.       push_to_sequence (use_insns);
  2681.       emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));
  2682.       use_insns = get_insns ();
  2683.       end_sequence ();
  2684.     }
  2685.     }
  2686.  
  2687.   fun = prepare_call_address (fun, NULL_TREE, &use_insns);
  2688.  
  2689.   /* Don't allow popping to be deferred, since then
  2690.      cse'ing of library calls could delete a call and leave the pop.  */
  2691.   NO_DEFER_POP;
  2692.  
  2693.   /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
  2694.      will set inhibit_defer_pop to that value.  */
  2695.  
  2696.   emit_call_1 (fun, get_identifier (XSTR (orgfun, 0)), args_size.constant,
  2697.            struct_value_size,
  2698.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  2699.            (outmode != VOIDmode && mem_value == 0
  2700.         ? hard_libcall_value (outmode) : NULL_RTX),
  2701.            old_inhibit_defer_pop + 1, use_insns, no_queue);
  2702.  
  2703.   /* Now restore inhibit_defer_pop to its actual original value.  */
  2704.   OK_DEFER_POP;
  2705.  
  2706.   pop_temp_slots ();
  2707.  
  2708.   /* Copy the value to the right place.  */
  2709.   if (outmode != VOIDmode)
  2710.     {
  2711.       if (mem_value)
  2712.     {
  2713.       if (value == 0)
  2714.         value = mem_value;
  2715.       if (value != mem_value)
  2716.         emit_move_insn (value, mem_value);
  2717.     }
  2718.       else if (value != 0)
  2719.     emit_move_insn (value, hard_libcall_value (outmode));
  2720.       else
  2721.     value = hard_libcall_value (outmode);
  2722.     }
  2723.  
  2724.   return value;
  2725. }
  2726.  
  2727. #if 0
  2728. /* Return an rtx which represents a suitable home on the stack
  2729.    given TYPE, the type of the argument looking for a home.
  2730.    This is called only for BLKmode arguments.
  2731.  
  2732.    SIZE is the size needed for this target.
  2733.    ARGS_ADDR is the address of the bottom of the argument block for this call.
  2734.    OFFSET describes this parameter's offset into ARGS_ADDR.  It is meaningless
  2735.    if this machine uses push insns.  */
  2736.  
  2737. static rtx
  2738. target_for_arg (type, size, args_addr, offset)
  2739.      tree type;
  2740.      rtx size;
  2741.      rtx args_addr;
  2742.      struct args_size offset;
  2743. {
  2744.   rtx target;
  2745.   rtx offset_rtx = ARGS_SIZE_RTX (offset);
  2746.  
  2747.   /* We do not call memory_address if possible,
  2748.      because we want to address as close to the stack
  2749.      as possible.  For non-variable sized arguments,
  2750.      this will be stack-pointer relative addressing.  */
  2751.   if (GET_CODE (offset_rtx) == CONST_INT)
  2752.     target = plus_constant (args_addr, INTVAL (offset_rtx));
  2753.   else
  2754.     {
  2755.       /* I have no idea how to guarantee that this
  2756.      will work in the presence of register parameters.  */
  2757.       target = gen_rtx (PLUS, Pmode, args_addr, offset_rtx);
  2758.       target = memory_address (QImode, target);
  2759.     }
  2760.  
  2761.   return gen_rtx (MEM, BLKmode, target);
  2762. }
  2763. #endif
  2764.  
  2765. /* Store a single argument for a function call
  2766.    into the register or memory area where it must be passed.
  2767.    *ARG describes the argument value and where to pass it.
  2768.  
  2769.    ARGBLOCK is the address of the stack-block for all the arguments,
  2770.    or 0 on a machine where arguments are pushed individually.
  2771.  
  2772.    MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
  2773.    so must be careful about how the stack is used. 
  2774.  
  2775.    VARIABLE_SIZE nonzero says that this was a variable-sized outgoing
  2776.    argument stack.  This is used if ACCUMULATE_OUTGOING_ARGS to indicate
  2777.    that we need not worry about saving and restoring the stack.
  2778.  
  2779.    FNDECL is the declaration of the function we are calling.  */
  2780.  
  2781. static void
  2782. store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl,
  2783.            reg_parm_stack_space)
  2784.      struct arg_data *arg;
  2785.      rtx argblock;
  2786.      int may_be_alloca;
  2787.      int variable_size;
  2788.      tree fndecl;
  2789.      int reg_parm_stack_space;
  2790. {
  2791.   register tree pval = arg->tree_value;
  2792.   rtx reg = 0;
  2793.   int partial = 0;
  2794.   int used = 0;
  2795.   int i, lower_bound, upper_bound;
  2796.  
  2797.   if (TREE_CODE (pval) == ERROR_MARK)
  2798.     return;
  2799.  
  2800. #ifdef ACCUMULATE_OUTGOING_ARGS
  2801.   /* If this is being stored into a pre-allocated, fixed-size, stack area,
  2802.      save any previous data at that location.  */
  2803.   if (argblock && ! variable_size && arg->stack)
  2804.     {
  2805. #ifdef ARGS_GROW_DOWNWARD
  2806.       /* stack_slot is negative, but we want to index stack_usage_map */
  2807.       /* with positive values. */
  2808.       if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
  2809.     upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1;
  2810.       else
  2811.     abort ();
  2812.  
  2813.       lower_bound = upper_bound - arg->size.constant;
  2814. #else
  2815.       if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
  2816.     lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1));
  2817.       else
  2818.     lower_bound = 0;
  2819.  
  2820.       upper_bound = lower_bound + arg->size.constant;
  2821. #endif
  2822.  
  2823.       for (i = lower_bound; i < upper_bound; i++)
  2824.     if (stack_usage_map[i]
  2825. #ifdef REG_PARM_STACK_SPACE
  2826.         /* Don't store things in the fixed argument area at this point;
  2827.            it has already been saved.  */
  2828.         && i > reg_parm_stack_space
  2829. #endif
  2830.         )
  2831.       break;
  2832.  
  2833.       if (i != upper_bound)
  2834.     {
  2835.       /* We need to make a save area.  See what mode we can make it.  */
  2836.       enum machine_mode save_mode
  2837.         = mode_for_size (arg->size.constant * BITS_PER_UNIT, MODE_INT, 1);
  2838.       rtx stack_area
  2839.         = gen_rtx (MEM, save_mode,
  2840.                memory_address (save_mode, XEXP (arg->stack_slot, 0)));
  2841.  
  2842.       if (save_mode == BLKmode)
  2843.         {
  2844.           arg->save_area = assign_stack_temp (BLKmode,
  2845.                           arg->size.constant, 1);
  2846.           emit_block_move (validize_mem (arg->save_area), stack_area,
  2847.                    GEN_INT (arg->size.constant),
  2848.                    PARM_BOUNDARY / BITS_PER_UNIT);
  2849.         }
  2850.       else
  2851.         {
  2852.           arg->save_area = gen_reg_rtx (save_mode);
  2853.           emit_move_insn (arg->save_area, stack_area);
  2854.         }
  2855.     }
  2856.     }
  2857. #endif
  2858.  
  2859.   /* If this isn't going to be placed on both the stack and in registers,
  2860.      set up the register and number of words.  */
  2861.   if (! arg->pass_on_stack)
  2862.     reg = arg->reg, partial = arg->partial;
  2863.  
  2864.   if (reg != 0 && partial == 0)
  2865.     /* Being passed entirely in a register.  We shouldn't be called in
  2866.        this case.   */
  2867.     abort ();
  2868.  
  2869. #ifdef STRICT_ALIGNMENT
  2870.   /* If this arg needs special alignment, don't load the registers
  2871.      here.  */
  2872.   if (arg->n_aligned_regs != 0)
  2873.     reg = 0;
  2874. #endif
  2875.   
  2876.   /* If this is being partially passed in a register, but multiple locations
  2877.      are specified, we assume that the one partially used is the one that is
  2878.      listed first.  */
  2879.   if (reg && GET_CODE (reg) == EXPR_LIST)
  2880.     reg = XEXP (reg, 0);
  2881.  
  2882.   /* If this is being passed partially in a register, we can't evaluate
  2883.      it directly into its stack slot.  Otherwise, we can.  */
  2884.   if (arg->value == 0)
  2885.     {
  2886. #ifdef ACCUMULATE_OUTGOING_ARGS
  2887.       /* stack_arg_under_construction is nonzero if a function argument is
  2888.      being evaluated directly into the outgoing argument list and
  2889.      expand_call must take special action to preserve the argument list
  2890.      if it is called recursively.
  2891.  
  2892.      For scalar function arguments stack_usage_map is sufficient to
  2893.      determine which stack slots must be saved and restored.  Scalar
  2894.      arguments in general have pass_on_stack == 0.
  2895.  
  2896.      If this argument is initialized by a function which takes the
  2897.      address of the argument (a C++ constructor or a C function
  2898.      returning a BLKmode structure), then stack_usage_map is
  2899.      insufficient and expand_call must push the stack around the
  2900.      function call.  Such arguments have pass_on_stack == 1.
  2901.  
  2902.      Note that it is always safe to set stack_arg_under_construction,
  2903.      but this generates suboptimal code if set when not needed.  */
  2904.  
  2905.       if (arg->pass_on_stack)
  2906.     stack_arg_under_construction++;
  2907. #endif
  2908.       arg->value = expand_expr (pval,
  2909.                 (partial
  2910.                  || TYPE_MODE (TREE_TYPE (pval)) != arg->mode)
  2911.                 ? NULL_RTX : arg->stack,
  2912.                 VOIDmode, 0);
  2913.  
  2914.       /* If we are promoting object (or for any other reason) the mode
  2915.      doesn't agree, convert the mode.  */
  2916.  
  2917.       if (GET_MODE (arg->value) != VOIDmode
  2918.       && GET_MODE (arg->value) != arg->mode)
  2919.     arg->value = convert_to_mode (arg->mode, arg->value, arg->unsignedp);
  2920.  
  2921. #ifdef ACCUMULATE_OUTGOING_ARGS
  2922.       if (arg->pass_on_stack)
  2923.     stack_arg_under_construction--;
  2924. #endif
  2925.     }
  2926.  
  2927.   /* Don't allow anything left on stack from computation
  2928.      of argument to alloca.  */
  2929.   if (may_be_alloca)
  2930.     do_pending_stack_adjust ();
  2931.  
  2932.   if (arg->value == arg->stack)
  2933.     /* If the value is already in the stack slot, we are done.  */
  2934.     ;
  2935.   else if (arg->mode != BLKmode)
  2936.     {
  2937.       register int size;
  2938.  
  2939.       /* Argument is a scalar, not entirely passed in registers.
  2940.      (If part is passed in registers, arg->partial says how much
  2941.      and emit_push_insn will take care of putting it there.)
  2942.      
  2943.      Push it, and if its size is less than the
  2944.      amount of space allocated to it,
  2945.      also bump stack pointer by the additional space.
  2946.      Note that in C the default argument promotions
  2947.      will prevent such mismatches.  */
  2948.  
  2949.       size = GET_MODE_SIZE (arg->mode);
  2950.       /* Compute how much space the push instruction will push.
  2951.      On many machines, pushing a byte will advance the stack
  2952.      pointer by a halfword.  */
  2953. #ifdef PUSH_ROUNDING
  2954.       size = PUSH_ROUNDING (size);
  2955. #endif
  2956.       used = size;
  2957.  
  2958.       /* Compute how much space the argument should get:
  2959.      round up to a multiple of the alignment for arguments.  */
  2960.       if (none != FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)))
  2961.     used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
  2962.          / (PARM_BOUNDARY / BITS_PER_UNIT))
  2963.         * (PARM_BOUNDARY / BITS_PER_UNIT));
  2964.  
  2965.       /* This isn't already where we want it on the stack, so put it there.
  2966.      This can either be done with push or copy insns.  */
  2967.       emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX,
  2968.               0, partial, reg, used - size,
  2969.               argblock, ARGS_SIZE_RTX (arg->offset));
  2970.     }
  2971.   else
  2972.     {
  2973.       /* BLKmode, at least partly to be pushed.  */
  2974.  
  2975.       register int excess;
  2976.       rtx size_rtx;
  2977.  
  2978.       /* Pushing a nonscalar.
  2979.      If part is passed in registers, PARTIAL says how much
  2980.      and emit_push_insn will take care of putting it there.  */
  2981.  
  2982.       /* Round its size up to a multiple
  2983.      of the allocation unit for arguments.  */
  2984.  
  2985.       if (arg->size.var != 0)
  2986.     {
  2987.       excess = 0;
  2988.       size_rtx = ARGS_SIZE_RTX (arg->size);
  2989.     }
  2990.       else
  2991.     {
  2992.       /* PUSH_ROUNDING has no effect on us, because
  2993.          emit_push_insn for BLKmode is careful to avoid it.  */
  2994.       excess = (arg->size.constant - int_size_in_bytes (TREE_TYPE (pval))
  2995.             + partial * UNITS_PER_WORD);
  2996.       size_rtx = expr_size (pval);
  2997.     }
  2998.  
  2999.       emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
  3000.               TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT, partial,
  3001.               reg, excess, argblock, ARGS_SIZE_RTX (arg->offset));
  3002.     }
  3003.  
  3004.  
  3005.   /* Unless this is a partially-in-register argument, the argument is now
  3006.      in the stack. 
  3007.  
  3008.      ??? Note that this can change arg->value from arg->stack to
  3009.      arg->stack_slot and it matters when they are not the same.
  3010.      It isn't totally clear that this is correct in all cases.  */
  3011.   if (partial == 0)
  3012.     arg->value = arg->stack_slot;
  3013.  
  3014.   /* Once we have pushed something, pops can't safely
  3015.      be deferred during the rest of the arguments.  */
  3016.   NO_DEFER_POP;
  3017.  
  3018.   /* ANSI doesn't require a sequence point here,
  3019.      but PCC has one, so this will avoid some problems.  */
  3020.   emit_queue ();
  3021.  
  3022.   /* Free any temporary slots made in processing this argument.  */
  3023.   free_temp_slots ();
  3024.  
  3025. #ifdef ACCUMULATE_OUTGOING_ARGS
  3026.   /* Now mark the segment we just used.  */
  3027.   if (argblock && ! variable_size && arg->stack)
  3028.     for (i = lower_bound; i < upper_bound; i++)
  3029.       stack_usage_map[i] = 1;
  3030. #endif
  3031. }
  3032.